The dungeon itself is the game/puzzle/challenge that the players are trying to overcome, either for the default goal of finding its treasure or for a specific goal like find a specific macguffin or other target. In this mode, the players trade their resources to overcome challenges and if you can achieve your goal without fighting or expending resources at all, the more the players are able to achieve. The default is not to fight every monster you encounter but to decide if you need to engage to achieve your goal. Random encounters are a way for the dungeon to fight back against the players and to put a clock on them - the longer they take to explore the dungeon or the less efficient they are in their exploration, the more they will have to deal with encounters that are unlikely to have any treasure at all.
It’s a very complex and interesting game to play. Unfortunately newer editions have gutted this gameplay by removing xp for gold (thus removing the default goal of most dungeons) and removing all of the procedural dungeon crawling rules. The tabletop form is still superior to CRPGs as your ability to interact with the world itself and overcome challenges in interesting ways is only limited by your imagination and ability to creatively apply the tools available to your character.
It’s a very complex and interesting game to play. Unfortunately newer editions have gutted this gameplay by removing xp for gold (thus removing the default goal of most dungeons) and removing all of the procedural dungeon crawling rules. The tabletop form is still superior to CRPGs as your ability to interact with the world itself and overcome challenges in interesting ways is only limited by your imagination and ability to creatively apply the tools available to your character.