It's the last day for students and staff at Roosevelt High School. The seniors are wild and unruly, setting off pranks on their classmates and teachers. English teacher Andy Campbell (Charlie Day) has his parking spot taken by a student on a scooter, and he is too meek and sensitive to do anything about it. History teacher Ron Strickland (Ice Cube) is the most feared teacher in school. He catches two boys taking a prized bat from the school's cage and replaced it with a computer so they can watch porn. Strickland orders them to put the bat back and leave. Some of the teachers are worried because they have evaluations later that day that will determine the fate of their jobs. Campbell in particular is worried because he and his wife Maggie (JoAnna Garcia Swisher) are expecting their second child.
Campbell gets pranked in his class when students draw dicks on his board. He gets pulled out by guidance counselor Holly Grossman (Jillian Bell) to let him know that some of the other English teachers have gotten canned, so his job might be safe. In the teachers lounge, Campbell, Holly, and their friend Coach Crawford (Tracy Morgan) discuss the possibility of losing their jobs when one teacher who had worked their for 22 years has just gotten fired. He prepares to take some stuff from the lounge until Strickland shows up and scares him.
Strickland tries to use the new coffee machine while complaining that the school's budget goes to stupid stuff. Campbell shows him how to work the coffee machine, but Strickland doesn't like how the coffee comes out. Campbell catches a student jerking off in the bathroom. He tries to get him to stop but is overheard by drama teacher Ms. Monet (Christina Hendricks). She considers Campbell a pervert following this encounter. On his way to class, Campbell is stopped by Strickland because he needs help in the class with AV equipment. Campbell says he can't and has to go to class, but Strickland stops him before he gets hit with some paint that the students set up as a prank.
Campbell then decides to go and help out in the class. Strickland is playing a video on a VCR but notices that the picture will play for a few seconds before turning off. Campbell sees that one student, Neil (Austin Zajur), is playing a prank by using a remote app on his phone to turn the TV off. Strickland takes his phone and smashes it against the chalkboard. As they resume the film, a girl passes her phone to Neil to continue the prank. When he does it again, Strickland leaves the classroom and returns with a fire ax. The students run away freaked out as Strickland swings down on Neil's desk and chops it to bits. Strickland and Campbell are called into Principal Tyler's (Dean Norris) office after he hears about the incident.
Strickland tells Campbell they need to stick together as teachers. However, Tyler threatens to fire both of them if he doesn't get a clear answer. Campbell caves and blames Strickland, resulting in Strickland getting fired. As payback, Strickland challenges Campbell to a fight later that day after school. Soon, word spreads around the school that the two teachers will fight each other. People spread rumors around as to why Strickland is so feared. They say he's an ex-cop, Special Forces, or just a plain old crazy killer guy. Holly and Crawford are confident that Strickland is going to kill Campbell with one punch.
Campbell tries to do what he can to avoid anything from happening. Ms. Monet approaches Strickland after hearing about the fight. Since she thinks Campbell is a pervert, she suggests to Strickland that he use a knife against Campbell.
Campbell tries to get Neil to take his word back on the classroom incident. Neil demands a MacBook Pro in return. Desperate, Campbell rushes to the nearest computer store to get it. He runs into Maggie and their daughter Ally (Alexa Nisenson). Maggie is worried that Campbell is there because he lost his job due to not sticking up for himself, which Ally agrees with.
When asked about the computer, Campbell passes it off as a surprise for Maggie. Ally reminds him that he is helping her with a talent show performance later, but instead of their rehearsed dance to a "Rent" song, she wants to use a Big Sean song because she is worried about getting bullied by another girl. Campbell agrees and then has to run and get another MacBook. Campbell and Neil tell Tyler that the incident was made up so that Strickland can get his job back. Both Campbell and Strickland are called into the Model UN room for a mediation. Campbell tells Strickland the issue was resolved and he got his job back, but Strickland is even more mad over this since Campbell didn't talk to him about it. The fight is still on. Campbell makes a 911 call to report the impending beatdown.
The operators on the other end laugh when Campbell tells them he's a teacher about to get beaten by another teacher. Campbell starts to have a breakdown in his classroom. He falls victim to a prank (literally) when the students put rope around his feet and use a horse doped up on meth to drag him out of the class and get sprayed with paint. Crawford also got sprayed as well.
Campbell then decides he's had enough and wants to put an end to the nonsense. He plans to set Strickland up by planting drugs in his classroom and getting him arrested. Campbell gets what is believed to be molly from Neil. On his way to Strickland's class, he runs into Tyler, who tells him his evaluation is now at 2:15, right before Ally's show. Campbell plants the drugs in Strickland's class and waits for the cops outside with Holly and Crawford. The drug-sniffing dog fails to sniff the drugs, and the cops leave. Holly takes out a joint, which Campbell grabs and runs into the class with so he can lure the cops back.
Strickland is already in the class and knows what Campbell is up to. Campbell lights the joint and brings back the cops plus campus security guard Mehar (Kumail Nanjiani). Both Strickland and Campbell get arrested. In their cell, Campbell blames Strickland for getting them into this mess.
Campbell goes over to a large inmate (Winston James Francis) and tells him that Strickland called him a bitch and that he wants to fight him. He tells the big guy to look out for Strickland nodding as the signal. Campbell goes back over to Strickland to instigate things, but Strickland says the fight is off since he only did it to prove a point in that the school doesn't care about what goes on if students are running around uncontrollably, and that Campbell isn't even man enough to fight. When Campbell tries to clarify that the fight is off, Strickland nods, bringing the big inmate over. Strickland realizes that Campbell set them up, so he takes down the big guy with a sleeper hold and tells Campbell the fight is still on. A cop comes over and says the guys are free to go because the molly was really aspirin. It's now 2:00.
Campbell rushes back to the school for his evaluation. Crawford comes out and tells Campbell that he, Holly, and Monet have all gotten fired. Campbell is forced to wait outside when it is nearly 2:30, meaning he will be late for Ally's show. Campbell barges into Tyler's office and sees him listening to a story from the superintendent (Dennis Haysbert). Tyler says that they've fired enough teachers for the day and must discuss upcoming changes to the school. When Campbell asks, Tyler says it's none of his business. Campbell finally puts his foot down and tells off Tyler and the superintendent for making him wait outside and trying to hurt the school even more.
He tells them they suck at their jobs and he leaves. Campbell rushes to Ally's school and comes in as she has done a pitiful solo performance of the "Rent" song. He goes over to Maggie and gets the DJ to play the Big Sean song. Campbell talks to Ally and apologizes for being late. They go out on stage to play the song. What Campbell didn't know is that the song Ally wants to play is "I Don't Fuck With You", which Ally directs to her bully, Trisha. Another teacher cuts off the music, but the rest of the kids love Ally's performance.
Campbell is proud of her and runs off to the fight. The entire student body is gathered outside for the big fight. Campbell is cheered on for showing up. He faces Strickland and the fight begins. Strickland gets the first punch easily, but Campbell gets back on his feet and gets some good swings in there. He bites Strickland's leg and also gets him with a stapler. Strickland uses more force in the fight, but Campbell doesn't stay down. He runs back into the school, and everyone follows.
Campbell tackles Strickland to the ground. He then gets a fire extinguisher to spray Strickland and then whack him over the head with it, taking him down. The students and staff cheer Campbell on as he runs outside, only for Strickland to come back and punch his lights out. Maggie then calls, and Strickland answers the phone. Strickland wakes Campbell up to inform him that Maggie is going into labor.
He pulls Campbell up and takes him to the hospital. Campbell goes to Maggie's room to meet with her. He explains everything he's been through that day and that he is finally going to stand up for himself. They then get ready for the baby. Sometime over the summer, the Campbells are having a barbecue with Holly, Crawford, and other friends. Ally is now more popular with the other kids.
Tyler shows up and tells Campbell that the fight attracted a lot of attention to the school board, and he must ask both him and Strickland to return to work, because his own job now depends on it. Campbell agrees to return on one condition. The final scene takes place at the first day of the new school year. Campbell got Tyler to rehire Holly, Crawford, and Monet. Strickland returns to the job with more respect for Campbell. The two spot a kid picking on another kid, and they both send the first kid to detention. The two then head off to teach their new classes.