In 2008, Deepak Kumar (Saif Ali Khan) is at an interview for the teacher's post at an affluent school. The interviewers turn him down when they discover his low-caste roots. Deepak relates the incident to his mentor, Dr. Prabhakar Anand (Amitabh Bachchan). Dr Anand, the legendary principal of renowned STM college, offers Deepak an interim job as a teacher at STM. Deepak is comforted by his friend, Sushant (an upper-caste boy), and his girlfriend Poorbi (Deepika Padukone), who is Dr. Anand's daughter.
The state minister, Baburam, wishes to enroll his no-good nephew at STM. Dr. Anand however, turns him down. The minister decides to install his own man, Mithilesh Singh, on the STM college board. Cunning and greedy, Mithilesh seeks only to enrich himself. The minister's grand ambition is to build a multi-billion educational conglomerate, and plans to use Mithilesh's outside business—a coaching class—for it.
The Supreme Court grants reservations for Other Backward Classes. A large crowd of STM students, boisterously celebrating the ruling, arrive at the gates of STM and start a ruckus. Sushant gathers a group of upper-caste boys and tries to drive off the revellers. Dr. Anand hauls Deepak and Sushant, but is shocked to find that Deepak has turned on him. Poorbi later confronts Deepak and orders him to apologise to her father, but he refuses, leading to their break-up.
The backward classes welcome reservations because it provides additional opportunities for education. The upper classes are against reservations because they do not believe in a level-playing field. These arguments are played out between Sushant and Deepak. The moderate STM administrators are afraid that college-level reservations may create conflicts between the students. When asked by a reporter, Dr. Anand shares his personal opinion – that some form of reservation, free of politics and economics, is good for society. The next day's headlines scream that Dr. Anand favours reservations. The STM board is outraged; Dr. Anand is warned that Mithilesh will use this to oust him. Dr. Anand resigns from STM, and Mithilesh is appointed as the new principal.
Dr Anand resolves to take out Mithilesh with the only weapon left: teaching. He approaches his friend, Shambhu the cowherd, and takes shelter at the tabela (cowshed). He begins teaching small groups of needy and backward students from the bastee (nearby neighbourhood), at the cowshed. His first success is Muniya (Aanchal Munjal), Shambhu's daughter who comes in first place at the board exam. Muniya's principal offers to send more students to Dr. Anand's tabela school. Deepak and Sushant return to Dr. Anand and join forces, teaching at the tabela school. The tabela students fare much better at the exams than their classmates. The tabela school's reputation grows and begins to draw away students at Mithilesh's coaching class.
Mithilesh responds by obtaining a legal permit to demolish the cowshed. The situation is diffused by the arrival of Shakuntala Tai, the reclusive magnate who started the STM institutions. She calls the chief minister, who promptly averts the destruction of the cowshed. Mithilesh is dismissed, and Dr. Anand is installed as the chief trustee of the STM and lifelong principal of the newly created STM Remedial Center.