After running away from home and falling into the Underground, you end up at the MTT resort in hotland, and the only way to get to the portal in the castle, is to go through the core, so thats what you do. But, when you reach the last room, you see Mettaton, waiting there.