Dungeons & Dragons started as an offshoot of wargaming, but it grew quickly. TSR, the company that owned the game, soon saw that people wanted more than just dungeons and wilderness areas for their heroes to explore. They wanted a semblance of a living fantasy world filled with history, personalities, and adventure.
The earliest settings, which I described last time, grew at the speed of adventure – new information got added as needed for a given module rather than in an atlas-like book. By the 1980s, though, D&D was realizing its media crossover potential. This led to a new wave of campaign settings that had a reach far beyond gaming tables.