It has been argued in several circles that D&D and AD&D, as far as the first editions are concerned, were more influenced by swords & sorcery than by the epic high fantasy of Tolkien. The presence of some elements of the former genre in the books seems to substantiate this claim: in the foreword to the AD&D Player Handbook 1st ed., Gary Gygax reveals the influence of swords & sorcery in the genesis of the game; the magic system copies Jack Vance's tales; the grey morality of greediness and lust for power that motivates most of the early expeditions into nearby dungeons (even if unintentional) colors the game and roots the game deep within the swords & sorcery genre, even the interior illustrations of some of the earlier books point to this as evidence. For instance, in B2 Keep on the Borderlands, there is a nice drawing of an adventuring group grabbing a thief by his ankles and shaking him to let loose all the treasure he most likely stole from the group. The thief's illustration in the 1st edition of the AD&D Player Handbook shows a man putting a knife to an unsuspecting victim's throat.
This is not to say Tolkien didn't play a big part in influencing the game. The semi-human races of Dwarves, Elves and, most especially Halflings, are quite obviously borrowed from The Lord of the Rings and other works. The many mythological creatures that populate the Monsters Manuals are, evidently, also borrowed from folk tales and mythology which also influenced Tolkien. But the focus on swords & sorcery is stronger I believe.
The first issue of the Dragon magazine, published in June 1976, includes a short story, penned by none other than Fritz Lieber, whose protagonists, Fafhrd and The Mouser, talk about their bafflement regarding wargamers and the new boardgame aptly called Lankhmar. And although the short story is about a wargame, its inclusion in the same magazine dedicated to Dungeons & Dragons strengthens this connection. It's undeniable that elements of Michael Moorcock, whose early Elric stories are swords & sorcery, have crept into the game.
Even if the heroes are trying to destroy the dark lord and save the free peoples, the system itself encourages seeking more power and riches. One levels up to become more powerful, to have better spells, to destroy bigger and more powerful monsters; one gains riches to buy better equipment or finds magic treasures to wield powerful artifacts or relics. I'm not knocking off the game itself. In fact, as of lately, I've come to embrace this mindset. I'm not a proponent of mindless romps through dungeons, but a dungeon, when done right, can be as rewarding as the most poweful tale of heroics and derring-do. It's just that I find the Conan stories mirror much better the tales of D&D / AD&D. One just needs to read The Tower of the Elephant and see that the entire story is about Conan trying to avoid the dangers of Yara's tower (a dungeon), with monsters (lions, guards and a deadly spider) in the company of another thief to finally destroy the big bad villain, with magic.
In later editions, the game adopted a more epic and fantastic nature, given form by the likes of Larry Elmore and Jeff Easley, whose extraordinary illustrations are more directly influenced by Tolkien and his ilk. But in the early days, heroes delved into deep dungeons, knee-deep in muck and blood, exploring long forgotten tombs and ruins, and unearthing horrors best left buries. And this is one of the things that most appeals to me in the earlier editions.