So why exactly are dungeons stuffed full of magical loot?
Or at least, why are people always sticking magic items underground, or at least in some cave somewhere?
Here are a few reasons I've come across in fiction.
Hidden by long-dead races.
"Ansorge," the Mindak said. "City of Everlasting Night. City of the Night People. The ones remembered as elves and trolls in your legends. They're dead now . . . Only their guardians remain. Their last project was to gather the wrack of war."
- from The Swordbearer, by Glen Cook
This idea is a pretty interesting one. Why are there hideously powerful magic items, but they aren't just tossed willy-nilly across the world in constant use in warfare and scheming and slaying?
Well, perhaps the last time that happened, some long-dead race gathered them up and buried them there. It makes for an interesting dungeon, and it would explain ordered tombs, treasuries with fiendish guards and horrible wards, and undying curses on those who pick the stuff up.
After all, these poor guys didn't spend their final days gathering up powerful magical items only to let you come by and get them without challenge. They aren't always a stockpile, though - the serpent men hid their magic crown on an island in Conan the Buccaneer, but didn't turn it into a city-sized stockpile like the folks of Ansorge.
It was put there for use by a future hero.
You usually get this for a very specific piece of gear; it doesn't explain a huge and odd assortment of goods. But it does explain some things being there.
". . . let us instead say, all those centuries ago, Egel looked into the future and saw this invasion, so he left his armor here, guarded by magic that only you - the earl - could break."
- Legend, by David Gemmell
But don't knock it as a bit of modern fiction unsuited to swords and sorcery. Where did Arnie get his sword in Conan the Barbarian? Crom either left it for him, or guided him to it.
Buried along with an ancient civilization.
It happens, especially if they used the magic item(s) in question in a somewhat self-destructive manner.
"The great metropolis of the empire vanished beneath the dust is now known only as the City Out of Mind.. The masters of the lost empire ruled from that city, and they used the Theorpart in their final battle. It lies there now, buried beneath a blanket of dust so deep that scarcely a trace of the city can be seen from the surface."
- Sea of Death, by Gary Gygax
The gods stuck them there.
Another one that usually explains single items or small clutches of items.
"Enter the Shade Gate . . . then you must seek the Tunnel Under the Marsh which leads to the Pulsing Cavern. In that chamber the runeswords are kept. They have been kept their since your ancestors relinquished them . . . "
- Elric of Melnibone, by Michael Moorcock
It could explain a huge stockpile, though, if the gods were especially thorough.
Crazy mage put it there.
As reasons go, this one pairs well with "An old man comes up to you in a tavern" for a full old-school course of dungeon delving. But it's used for good reason, because a crazy guy with powers explains a lot.
"It is well known that the labyrinthine dungeon, catacombs, and maze of subterranean passages beneath the ancient castle once held a conglomerate of monsters and a plethora of treasure - all there at the whim of the lord archmage who ruled within."
- Night Arrant, by Gary Gygax
(more of that quoted passage is here)
This fictional piece is an offshoot of gaming, of course, where it's the grandaddy of all explanations of why there is a bucketload of magic swords in a hole in the ground.
Any other fictional reasons for magic items stuck in tunnels underground that I'm missing? I'm not just wondering about why magic items might be underground. I'm wondering about fictional writeups of the same.
[Editing later - commentators posted a bunch of good reasons for magic items in dungeons . . . but my point was to explore some of the reasons in published fiction for magic items in dungeons. So guys, I'm afraid I'm going to have to ask for some citations. ;]