Papyrus, such an elegant and fun character, full of great japes and jokes. Well, at least, he would be, if his parents weren't dead. Ever since grade school, the kids in his classes laughed at Papyrus's fatal flaw. Saying stuff like:
"You and your family are supposed to be skeletons, so why would your parents be literally dead. That's so stupid, you twig"
And they also made a lot of yo momma jokes for papyrus such as this one:
"Yo momma's so stupid, she forgot she couldn't die."
…Oh, Papyrus… I don't know how your brother puts up with you. Your parents certainly couldn't put up with you because they are dead, but if they could, they would probably die again just to remove you from their lives.
Sans was a pretty chill guy. Honestly, if you ever with met him, you probably wouldn't even think that he was papyrus's brother at all. In fact, he probably wasn't. Papyrus probably was so stupid one day that he just assumed Sans was his brother, and Sans was probably too chill to say anything about it. I suppose after that moment, Sans started to grow closer to Papyrus, and started to see him as a brother too. Poor Sans, I feel kind of bad for the guy.
After Papyrus probably fake graduated from monster middle school, Sans thought it would be a good idea for him to find a job. He certainly wasn't going to last through monster high school, and with his parents being dead, it didn't really leave him to aspire to anything useful. Unless you consider papyrus being dead as useful, which I very much do.
It certainly could not be a real job, the underground isn't filled with idiots like Papyrus. Instead, Sans asked Undyne (a significant person in the underground) about a more practical way to occupy his time. Maybe he could became a lawn ornament, or a life size lamp. As well-suited as these jobs are to Papyrus's expertise, Sans thought it would be best to make him up a job for his less fortunate brother. After all, the only real job an orphan like Papyrus should deserve is a non-existent job; just like his non-existent parents.
A trainee for the royal guard, Sans thought it was a perfect job for such a brainless skeleton, because Papyrus really loved to build puzzles and traps. Really stupid ones, but still. So Sans sent Papyrus on a mission. To catch humans. If he sees one, just catch it, as simple as that. Alphys, the royal scientist, tried to feed into Papyrus's delusions by giving him some cool traps and machines. Unfortunately, Papyrus was stupid and often forgot how to operate them; needless to say, if didn't work out that well. Papyrus wasn't into that stuff anyway, he had BIG plans of his own. He decided he wanted to leave the underground, and capture all humans... His brother was going to be so proud. But not his parents, because they were dead and Papyrus was an orphan.