Once upon a time, humans and monsters lived peacefully. But war broke out, and monsters won. Humans fled to the underground. Toriel wanted to show Asgore that humans could be good. She went to the entrance of the underground. Humans feared her immediately, and killed her. Asgore made it law, out of guilt and anger, that all humans will be killed if they reach the surface.
Years later, Frisk wanted to set her people free, so she wanted to talk to the leader of the monsters to convince him to let the humans free. Muffet was the guard because humans feared her. Frisk said she would let Muffet leave if she let her pass. Muffet gives Frisk a spider to show Asgore that she let her pass. Frisk reaches the surface. The spider Muffet gave Frisk tells her not to trust monsters because they left the spiders behind.
Frisk can choose to listen to the spider or to not.