Dungeon
Middle English (also with the sense ‘castle keep’): from Old French (perhaps originally with the sense ‘lord's tower’ or ‘mistress tower’), based on Latin dominus ‘lord, master’. Compare with donjon.
wiktionary
From Middle English dungeon, dungeoun, dongoun, dungoun, dungun(“a castle keep" also, "a prison cell below the castle; a dungeon; pit; abyss”).
The Middle English word is apparently a merger of Old French donjon(“castle keep”) and Old English dung(“a subterranean chamber; a prison; dungeon”), which supplied the current sense of the word. Old French donjon may itself be a conflation of Vulgar Latin *domnione (from Late Latin *dominiōnem, from Latin dominium(“lordship; ownership”) and Frankish *dungijā(“prison, dungeon, underground cellar”). Compare Middle English dung, dunge, dong, donge(“pit of hell; abyss”)
Both the Frankish and Old English words derive from Proto-Germanic *dungijǭ(“an enclosed space; a vault; bower; treasury”), from Proto-Indo-European *dʰengʰ-(“to cover”), and are related to Old Saxon dung(“underground cellar”), Middle Dutch donc(“underground basement”), Old High German tung(“underground cellar; an underground chamber or apartment for overwintering”) (whence German Tunk(“manure or soil covered basement, underground weaving workshop”)), Old Norse dyngja(“a detached apartment, a lady's bower”); whence Icelandic dyngja(“chamber”)). See also dung, dingle.
The game term has been popularized by Dungeons & Dragons.
etymonline
dungeon (n.)
c. 1300, "great tower of a castle," from Old French donjon "great tower of a castle" (12c.), from Gallo-Roman *dominionem, from Late Latin dominium, from Latin dominus "master" (of the castle), from domus "house" (from PIE root *dem- "house, household"), so called probably for its commanding position or strength. Sense of "castle keep" led to that of "strong (underground) cell" in English early 14c. The original sense went with the variant donjon.