It began with going into a "Dungeon" (the areas underneath a fortress) during the development of the game Dungeons and Dragons.
According to Gary Gygax (in an interview with Dungeon #112), the first dungeon crawl1 was part of a wargame in which the invading force entered the enemy's castle through a former escape tunnel dug from the fortress's dungeon. The group had so much fun with this scenario that it was repeated over and over with increasingly complex dungeons until the wargame aspect of the game was dropped in favor of exploring the dungeon.
Origin in Publication: the dungeon is where Underground adventures take place
The dungeon as a place to conduct an underworld adventure is spelled out in the opening paragraphs of Volume III of the Original Publication of Dungeons and Dragons "Wilderness and Underworld Adventures" on page 3. (© COPYRIGHT 1974 • TACTICAL STUDIES RULES, by Gary Gygax and Dave Arneson).
Before it is possible to conduct a campaign of adventures in the mazey dungeons, it is necessary for the referee to sit down with pencil in hand and draw these labyrinths on graph paper. Unquestionably this will require a great deal of time and effort and imagination. The dungeons should look something like the example given below, with numerous levels which sprawl in all directions, not necessarily stack neatly above each other in a straight line.
Why Dungeons and Dragons?
The "Dungeons and Dragons" game was going to be called "The Fantasy Game" as far back as 1971. The founders of TSR had difficulty in selling the game initially. Gary Gygax had been working in game rules and fan magazine publishing since about 1965. He and his early partners (Arneson, Kaye and Blume) doubtless knew how important a title/name/brand was in getting a product to market, even the small market of miniatures and wargames enthusiasts. It was renamed in 1973. The game rules (cf. above) indicate that "dungeon" had become standard jargon during the game's development.
- Note: Alliteration is an old tool in publishing, witness how headlines get written in newspapers and gossip magazines in the golden era of print media.
Dave Arneson was up in St. Paul and not with me when I wrote down two
single-word lists of possible titles for the game. I did ask my player
group which they liked, also queried my family. My youngest daughter
Cindy, was adamant that I must use "Dungeons & Dragons." As a number
of others were in agreement with that choice, and I liked the
alliteration, that's what I went with when I took the mss. I had
written to the printer in early December 1973. ~ Gary Gygax
Two Meanings of "Dungeon" in the game's context
By the time of the game's first publishing run, dungeon had two connotations in this new sense:
- the generic setting for an underworld adventure and is below ground, dark, and dangerous
- the D&D campaign/setting run by a given person.
The second usage is probably as old as the playtests Arneson's playing group, and later Gygax undertook (early 1970's) in the adventures under Arneson's Blackmoor castle.
This jargon (unique to a small community of gamers) is seen in the TSR newsletter The Strategic Review #6 (Volume II No. 1, Feb 1976) on page 7 in one of E. Gary Gygax' articles:
DunDraCon I: Update
Some of the misleading advertising has been clarified in regard to the
“Fritz Leiber” dungeon that has been advertised. The truth of the matter is that there exists a sprawling palace, complete with underground, that has been constructed/ populated by a friend of Mr. Leiber’s, with his aid and direction. It is said to contain hazards and treasures drawn from his stories. Fritz has also agreed to attend for a couple of hours, at least, on one of the two days. (We have been told the preceding facts, and have accepted them in good faith.)
The jargon had apparently become so ingrained -- among the people playing in the settings Arneson (Blackmoor) and Gygax (Greyhawk) used to playtest original adventure milieus -- that the authors saw no need to explain why they used "dungeon" as opposed to something else.
In an interview with theonering.net Gygax said that his initial vision was that this game would be for gamers. It took a little while for the TSR team to see, and capitalize on, its broader appeal. When the initial set of rules was published, it was a case of "gamers publishing for gamers (and we all speak in the same jargon so we don't need to explain it)."
Personal Experience: the second usage had spread, and was present as far back as 1975, when I first began to play Dungeons and Dragons. We would ask one another "whose dungeon are we playing in?" to decide who would be the game master/dungeon master for the next session. It obviously preceded our experience -- we lived in Virginia and the game spread from the Wisconsin-Chicago area (in our case, through a game store where a friend bought the first boxed set any of us had seen). There was no internet to spread memes or jargon at the speed that they now spread.
Per @Lexible's comment on this not always translating well into other languages, like the French edition called Donjons et Dragons ... from the Wiktionary etymology article.
The word "dungeon" comes from Old French donjon (also spelled dongeon), which in its earliest usage meant a keep, the main tower of a castle. The first recorded instance of the word in English was near the beginning of the 14th century when it held the same meaning as donjon. In French the term donjon still refers to a "keep", and the term oubliette is a more appropriate translation of English "dungeon". Donjon is therefore a false friend to "dungeon" (for instance, the game "Dungeons & Dragons" is titled "Donjons et Dragons" in its French editions).
Another example is Brazilian Portuguese, Caverna do Dragão (i.e. "Cave of the Dragon," or "the Dragon's Cave"), which doesn't include a cognate of "dungeon." Crossing languages barriers often leads to idiomatic rather than literal translations.
1Per @RobertF a dungeon crawl has developed into a standard gaming model where a band of diverse adventurers (wizard, fighter, elf, dwarf, ranger, etc.) battle monsters in an underground setting, including a final boss monster -- a literary template being the Mines of Moria from J. R. R. Tolkien's The Fellowship of the Ring.