You're new to the UNDERGROUND, aren'tcha?
Flowey, after introducing himself
The setting of the vast majority of Undertale, the Underground is a large region underneath the Surface of the Earth, which houses the kingdom of Monsters. The exit from the Underground is blocked by the Barrier, which was placed by the Humans ages ago. Humans access it, the protagonist included, by way of a hole in Mount Ebott. It is ruled by King Asgore, and formerly by his ex-wife as well, Toriel. Spanning several different climates, the Underground features the Ruins, the cold and wintery Snowdin, the wet and cavernous Waterfall, the blistery and barren Hotland, the technologically advanced CORE, and the Capital.
After the Humans defeated the Monsters in The War, the losing faction was banished into the Underground. A Barrier was erected to prevent the insiders from leaving, though outsiders could still freely enter. The monsters eventually accepted their loss and lived normal lives throughout the Underground.
One day, a human named Chara walked to Mt. Ebott and unfortunately tripped on a vine, causing them to fall into a pit and enter the Underground. Chara was discovered by Asriel Dreemurr, the son of Asgore and Toriel, and was adopted into their family. However, the human one day grew ill and eventually died from the illness, but wished to see the flowers in their home village. After Chara had died, Asriel absorbed their SOUL, becoming a powerful entity that was able to cross the Barrier, and picked up their corpse and carried it out of the Underground. However, the humans from the outside world attacked Asriel, under the assumption that he killed Chara, forcing him to return to the Underground with Chara's corpse where he succumbed to his wounds.
Since then, Asgore became vengeful for his son and plotted to escape the Underground and declare another war against humans. He declared all humans who fall into the Underground be killed and their SOULs collected; with seven human SOULs, the Barrier could be shattered. However, the brutality of this decision disgusted Toriel enough that she relinquished her position as queen as well as her marriage to Asgore.
Asgore continued to rule the land on his own while Toriel exiled herself into the Ruins. Over time, six more humans fell into the Underground, all of which Toriel tried to shelter and care for. However, they all eventually left the Ruins and were eventually killed, their SOULs collected by Asgore.
An eighth human, the protagonist, had then fallen into the Underground. Unlike the predecessors, the protagonist's Determination carried them through many obstacles the Underground had presented, even managing to befriend or kill many monsters. Eventually, the protagonist manages to reach Asgore, where he stands before the Barrier. One of few events occur depending on the protagonist's actions:
- On the Neutral Route, the protagonist and Asgore battle. The latter is defeated, after which Flowey intervenes and absorbs the six human SOULs. The protagonist defeats Flowey and is somehow transported outside the Barrier after the event, where they leave the Underground. Sans then calls the protagonist and tells them the fate of the Underground, which is either peaceful or grim depending on who was killed.
- On the True Pacifist Route, Asgore is stopped by Toriel and all of the protagonist's friends but are then ambushed by Flowey, who proceeds to absorb the six human SOULs as well as the SOULs of all the monsters in the Underground, reverting to his true form, Asriel. However, with all the SOULs, Asriel gains compassion and ultimately loses the will to fight, and instead he uses their power to shatter the Barrier. Having returned the SOULs, Asriel leaves, knowing that he will revert to Flowey, and begs the protagonist to forget him. The monsters are free to leave the Underground and live peaceful lives on the surface.
- On the Genocide Route, certain monsters try to stop the protagonist's murderous rampage while Alphys leads the evacuation. Upon reaching Asgore, the protagonist instantly defeats him with one blow and proceeds to destroy Flowey mercilessly. Chara appears before the protagonist and explains that their determination brought them back to life. With the protagonist's guidance, they realized that the true purpose of their reincarnation was to gain power. Chara then, with or without the protagonist's consent, uses that power to destroy the world.
- The Eight Humans falling to the Underground might be a reference to Alice in Wonderland.