Best friends George Beard (voice of Kevin Hart) and Harold Hutchins (voice of Thomas Middleditch) tell the story of one of their comics - long ago in a galaxy far, far away, there was a planet that wore underpants which was set to blow up. The king and queen of the planet sent their baby to Earth where he was raised by a dolphin couple. That baby grew quickly and would become Captain Underpants, George and Harold's superhero creation. As they complete their origin issue, it is snatched up and torn apart by the boys' mean principal Mr. Krupp (voice of Ed Helms). George and Harold address the viewers to let them know that Krupp hates just about everything fun and is always out to make their lives miserable. The boys are brought into Krupp's office. While he doesn't have evidence, he knows the boys are responsible for a number of elaborate pranks set across Jerome Horwitz Elementary School, including (but not limited to) putting silly pictures of a teacher on the board, gluing a teacher's butt to her chair, and bringing a tiger into class.
Krupp vows to put an end to their trouble. As George and Harold walk to class, they explain that they make up pranks to cheer up the students, all of whom are utterly miserable at school. They get to class where they sit behind their nerdy nemesis Melvin Sneedly (voice of Jordan Peele), who has no sense of humor. Over the loudspeaker, Krupp announces that all students are required to spend their Saturday at the school's Invention Convention, which only Melvin is excited for.
The boys go to George's treehouse where they have their own comic studio, Treehouse Comix Inc. They mention how the two of them became friends in kindergarten - they both laughed when the teacher was talking about the planet Uranus and called it a "gas giant". Thus, George and Harold became lifelong best buddies. On Saturday, the boys get excited about what they get to do for the day, until their moms remind them they have to go to the Invention Convention. All the kids dejectedly trudge into the school auditorium. Melvin goes up to present a bunch of his inventions, which bores everyone and even puts Mr. Krupp to sleep.
Seeing an opportunity, Harold convinces George to pull off their best prank yet. They sneak behind Melvin's Turbo Toilet invention and rig it to start shooting toilet paper rolls across the room and flashing lights everywhere. The kids all love it. The boys walk out of the school feeling triumphant until they are called into the office of Mr. Krupp. Krupp has Melvin come into the office to show the boys that he's finally got proof of their pranks. Melvin hands over his Tattle Toad, which has a nanny cam inside.
It clearly shows George and Harold messing with the Turbo Toilet. Now that Krupp has dirt on them, he can finally put the boys in separate classes, thereby keeping them apart as friends. Harold freaks out about Krupp splitting him and George up. He imagines a world where the two no longer see each other and awkwardly bump into each other at the mall before getting attacked by robots (because it's the future) and a giant version of the Tattle Toad. George agrees that it's bad and they plot to stop Krupp. At school, the boys wait for an opening to sneak into Mr.
Krupp's office. They see him sharing a mutual attraction with Edith (voice of Kristen Schaal), the school's lunch lady who made him a tuna casserole. Krupp follows Edith but his secretary enters the office before George and Harold can get in. They distract her by calling the office and putting her on hold so she may win a billion dollars.
The boys sneak past her and get into Krupp's office where they find a drawer full of things he confiscated from them over the years, including a whoopie cushion, their old comics, and a Hypno-Ring from a cereal box. Krupp then returns, and he prepares to sign papers to separate George and Harold. Desperate, George jumps onto Mr. Krupp's desk and uses the Hypno-Ring on him. The room literally spins as Krupp is put in a trance. George and Harold have fun with this by making Krupp act like a chicken and monkey, but then they get the idea to turn him into Captain Underpants. Krupp rips off his clothes (except his undies) and pulls off a curtain to make a cape before declaring "Tra-la-laaaaaaaa!" The boys think it's hilarious until Captain Underpants jumps out the window and runs into the street, getting hit by a car. George and Harold run after Captain Underpants as he makes his way into the city.
He sees a mime and thinks he is trapped in an invisible box, so he tries to "break" it by punching through it, hitting the mime in the face. Captain Underpants then throws an old lady into a tree as she tries to get her cat. He then goes up to a tall building to face what he thinks is a giant monster, but it's really just a big inflatable gorilla. The boys rush to stop him before he hurts himself. They pop the balloon and make Captain Underpants land on two bank robbers trying to get away, making him look like a real hero catching bad guys. George and Harold take him away before the cops get to him.
Meanwhile, a short little man (Nick Kroll) sees a flyer for a teaching position at the elementary school. He starts to laugh sinisterly. The boys take Captain Underpants back to the treehouse. When he gets wet, he turns back into Mr.
Krupp. As long as the boys keep snapping their fingers, he will stay as Captain Underpants. However, while he's at school, they need to have him pretend to be mean old Mr. Krupp to keep up appearances.
They run into Edith, who asks about the tuna casserole. Captain Underpants comments on her blue eyes, charming her. The boys take him to his office, but they find the little man from before applying for the science teacher job. He goes by Professor P, and he starts his interview with Captain Underpants. George and Harold notice Professor P pulling out a number of weapons (a mace, an axe, etc). They read his resume, which clearly highlights his plans for revenge, but Captain Underpants hires him on the spot.
Professor P starts teaching science. He talks to the children about the parts in a child's brain, specifically the part that responds to anything humorous. Professor P really hates laughter and wants to get rid of it completely, which Melvin sympathizes with since he finds nothing funny. George makes a joke that the class laughs at, causing Professor P to send him and Harold back to Krupp's office. The boys return to the office, but Krupp has gotten himself wet, so he's back to being mean.
The boys snap their fingers and he's Captain Underpants again. They use him to get Professor P's file from the secretary, and they learn that his real name is Professor Poopypants. Poopypants comes into the cafeteria and sees all the kids laughing. They are reading George and Harold's latest comic, "Captain Underpants and the Perilous Plot of Professor Poopypants". This triggers a flashback for Poopypants when he was set to win a prize for inventing a gun that shrinks and grows things.
However, when his name was spoken aloud, everyone laughed and could not take him seriously, starting his drive for revenge. When George and Harold show up, Poopypants takes them to see Mr. Krupp, but he's still Captain Underpants. Poopypants notices a character in the comic named Anti-Humor Boy, who is supposed to be Melvin. The boys take an unconscious Mr. Krupp home. They decide to snoop around for fun, only to discover that Mr. Krupp is really lonely.
Poopypants finds Melvin and uses him as part of his evil plan. He scans Melvin's brain and learns that he doesn't have the part in the brain that responds to humor. This becomes crucial to his plan. Captain Underpants throws a carnival for the whole school. Things get chaotic as he keeps getting wet, and the boys have to keep snapping their fingers. Captain Underpants starts feeding the kids sugar, and George and Harold want in on it. This turns out to be a bad idea because they experience a strong sugar rush, leading Captain Underpants to his own devices. He tries to drive a bus through rings of fire over a ramp, but he gets wet and slows it down.
After a finger snap, he rides the bus backwards into a Ferris wheel, which comes loose and rolls toward the school. Captain Underpants sails down in a parachute, but it starts raining, and he's Mr. Krupp again. Since he cannot be snapped back to Captain Underpants, Mr. Krupp is now able to get the boys in trouble.
Mr. Krupp puts George and Harold in separate classes. The boys sadly walk away from each other. Poopypants and Melvin are ready with their invention, a giant version of Melvin's own invention, the Turbo Toilet 2000. When they try to start it up, they find that it has no fuel. Melvin leads Poopypants to the school's cafeteria where they get a stash of toxic leftover food to use as fuel. The Turbo Toilet starts stomping around outside the school.
George and Harold see it from their classes and both ask to be excused. They reunite in the bathroom but they witness the villains use Melvin's brain to power a beam that zaps the children and turns them into humorless drones. The boys run to get Captain Underpants. He joins the fight, but - as shown through George and Harold's flip-o-rama book since they claim the scene would be too violent and expensive - the Turbo Toilet beats Captain Underpants easily.
Poopypants drops Captain Underpants into the toilet's mouth before grabbing George and Harold. He zaps them to rid them of their laughter, but he sees that the humor part of their brains are way too big. Slowly, the humor starts to drain from them, turning them into drones as well. Then Poopypants says "Uranus", reverting the boys back to their normal state. The Turbo Toilet starts to malfunction as a result. Melvin bails out and the Toilet comes crashing down.
Unwilling to accept defeat, Poopypants pulls out his shrink/grow gun. He tries to hit the boys with it but hits things like the school and a bird. In the Toilet, Captain Underpants consumes the leftovers, giving him real superpowers. He flies out of the Toilet and starts to fight Poopypants. The boys get the gun from him and they shrink him while (mostly) turning things back to normal.
However, Poopypants escapes on a bee. The boys are with Captain Underpants in their treehouse. Knowing they can't keep him like this forever, George and Harold accept that maybe they have to deal with being in separate classes. George breaks the Hypno-Ring, and Mr. Krupp is back. He freaks out over being nude and he runs away. George and Harold then realize that the difference between Mr. Krupp and Captain Underpants is that Captain Underpants has them, but Mr.
Krupp has nobody. They then plan their newest prank. Mr. Krupp finds a note in his mail at school. George and Harold made a card pretending to be Edith, and they sent her one as Mr. Krupp, asking each other on a date. The two of them are excited, and Mr. Krupp is happier than usual.
He then returns the Captain Underpants comics to the boys, admitting that he read them and thought they were pretty funny. Mr. Krupp and Edith go on their date. George and Harold see them in a restaurant, and they agree not to do something so nice like that again. Next to the restaurant, the Turbo Toilet spills the toxic leftovers onto a bunch of dumped toilets, mutating them into monsters. One toilet attacks the restaurant, leading Krupp to ask for the check. He snaps his fingers and causes himself to turn back into Captain Underpants.
The boys are surprised as he flies out of the restaurant, fighting all the toilets. He then flies into the sky with George and Harold latching onto his cape as they say "Here we go again!"During the credits, Mr. Krupp's secretary is STILL on hold for the billion dollars. George and Harold walk by her and go back to the phone.
They startle her and she accidentally hangs up. Cue her scream of rage..