A rock band called No Vacancy performs at a nightclub three weeks before auditioning for the Battle of the Bands competition. Guitarist Dewey Finn (Jack Black) performs on-stage antics, including a failed stage dive that abruptly ends the band's performance. The next morning, Dewey wakes up in the apartment he lives with Ned Schneebly (Mike White) and his domineering girlfriend Patty Di Marco (Sarah Silverman). They inform him that he must make up for his share of the rent or move out. When he meets No Vacancy at a rehearsal session, he finds out that he has been replaced by another guitarist named Spider. Later, while attempting to sell some of his equipment for rent money, Dewey answers a phone call from Rosalie "Roz" Mullins (Joan Cusack), the principle of the Horace Green prep school, inquiring for Ned about a short-tern position as a substitute teacher. Needing money, Dewey impersonates Ned and is hired for the job. On his first day at the school, Dewey adopts the name "Mr. S" as he is unable to spell the name 'Schneebly', and spends his first day behaving erratically, much to the class's confusion.
The following day, Dewey overhears a music class and devises a plan to form them into a new band to audition for the Battle of the Bands competition. He casts Zack Mooneyham as lead guitarist, Freddy Jones as drummer, cello player Katie on bass, Lawrence on keyboards, and himself as lead vocalist and guitarist. He assigns the rest of the class to various roles of backup singers, groupies, roadies and security, with Summer Hathaway (Miranda Cosgrove) as band manager. They project takes over normal lessons, but helps the students embrace their talents and overcome their problems. He reassures Lawrence, who feels nerdy, and is worried about not being cool enough for the rest of the band; Zach, whose overbearing father disapproves of rock and roll music; and Tomika, an overweight girl who is too self-conscious to even audition for backup singer, despite having an amazing voice. During one eloquent lesson, he teaches the children that rock and roll is the way to "Stick it to the Man" and stand up for themselves.
Two weeks into his hiring, Dewey sneaks his main band members out of the school to audition for the Battle of the Bands competition, while the rest of the class remain behind to maintain cover. When Freddy wanders off to be with other much older musicians, Dewey retrieves him and chastises him for doing so. Unfortunately, the group is rejected as the bill is full. However, Hathaway comes up with a plan to deceive the organizers into thinking that the band is made up of terminally ill children. The plan works, and the band is ready to play. The next day, band groupies Michelle and Eleni, with Hathaway's approval, pitch the band name "The School of Rock". Almost immediately afterwards, Rosalie decides to check on Dewey's teaching program, forcing Dewey to teach actual material. Roz explains that a parents' night will take place at the school he day before the Battle of the Bands competition, rendering Dewey somewhat concerned.
As Dewey prepares for the parents' night, Ned receives a paycheck from the school via mail and realizes that Dewey has been impersonating him. During the parents' meeting, the parents question what Finn has been teaching the children until Ned, Patty and the police confront Dewey. With Roz bursting in to question what is going on, Dewey reveals his true identity, admits he is not a licensed teacher and flees to his apartment where he and Paty later argue. Ned intervenes to break up the argument, Dewey apologizes to Ned and admits that he cannot give up music. Understanding, Ned opens up to Dewey, stating that he misses his old life being part of a rock band called Maggot Death, and explains that he chose to move on with his life after realizing that it was not becoming the career he had hoped it would be. Ned suggests that Dewey should do the same, and also move out.
The next morning, the parents chastise Roz in her office. The children decide not to allow their hard work go to waste and sneak out of the school. When the new substitute discovers that they are missing, she informs Roz, who determines that they have gone to the competition. A school bus with the children comes to pick up Dewey, which takes them to the Battle of the Bands competition where they decide to play the song written by Zack. Initially dismissed as a gimmick, the band wins over the crowd. However, much to Dewey's dismay, his old band whom he was kicked out earlier No Vacancy wins. During this announcement, the audience chants "School of Rock", demanding an encore. The band retakes the stage and begins performing "It's a Long Way to the Top (If You Wanna Rock 'n' Roll)" by AC/DC. Meanwhile, Ned, Roz and most of the childrens' parents have arrived in the audience. They are impressed and proud of Dewey and the band, much to the dismay of Patty, whom Ned breaks up with.
Some time later, an after-school program known as the School of Rock has opened. We see Dewey continue to coach the students he previously played with, while Ned teaches beginner students.