A Subgame is effectively a game within a game. Only two cards have been printed which will begin one: Shahrazad and (create). Since Enter the Dungeon was printed in Unhinged, a non-tournament-legal set, only Shahrazad was ever legal. Even that was banned as of September 20, 2007 for time delays and space problems.
506.1. Some cards allow players to play a Magic subgame.
506.1a A "subgame" is a completely separate Magic game created by a card's effect. The "main game" is the game in which the spell or ability that created the subgame was played. The main game is temporarily discontinued while the subgame is in progress. It resumes when the subgame ends.
506.1b No effects or definitions created in either the main game or the subgame have any meaning in the other, except as defined by the effect that created the subgame. For example, the effect may say that something happens in the main game to the winner or loser of the subgame.
506.2. As the subgame starts, an entirely new set of game zones is created. Each player takes all the cards in his or her main-game library, moves them to his or her subgame library, and shuffles them. No other cards in a main-game zone are moved to their corresponding subgame zone. Randomly determine which player goes first. The subgame proceeds like a normal game, following all other rules in section 101, "Starting the Game."
506.3. Any rules regarding the size of a player's deck are ignored for the subgame. However, because each player draws seven cards when a game begins, any player with fewer than seven cards in his or her deck will lose the subgame when state-based effects are checked during the upkeep step of the first turn, regardless of any mulligans that player takes. (See rule 420, "State-Based Effects.")
506.4. All objects in the main game and all cards outside the main game are considered outside the subgame (except those specifically brought into the subgame). All players not currently in the subgame are considered outside the subgame.
506.4a Some effects can bring cards into a game from outside of it. If a card is brought into a subgame from a main game, abilities in the main game that trigger on objects leaving a main-game zone will trigger, but they won't be put onto the stack until the main game resumes.
506.5. At the end of a subgame, each player puts all cards he or she owns that are in the subgame into his or her library in the main game, then shuffles them. This includes cards in the subgame's removed-from-the-game zone. (This is a change from previous rules.) All other objects in the subgame cease to exist, as do the zones created for the subgame. The main game continues from the point at which it was discontinued: First, the spell or ability that created the subgame finishes resolving, even if it was created by a spell card that's no longer on the stack. Then, if any main-game abilities triggered while the subgame was in progress due to cards being removed from the main game, those abilities are put onto the stack. Example: If a card was brought into the subgame either from the main game or from outside the main game, that card will be put into its owner's main-game library when the subgame ends.
506.6. A subgame can be created within a subgame. The existing subgame becomes the main game in relation to the new subgame.