Narayan Shankar (Amitabh Bachchan) is the strict headmaster of Gurukul, a prestigious all-boys university. Narayan wants the best out of his students, and places emphasis on tradition, honor and discipline. He has run the university for 25 years, over that time has forbid the students from any kind of romance — anyone he catches falling in love will be expelled.
The film focuses on three of the school's students: Sameer (Jugal Hansraj), Vicky (Uday Chopra) and Karan (Jimmy Shergill) who all fall in love. Sameer is in love with Sanjana (Kim Sharma), his childhood friend. Vicky falls for Ishika (Shamita Shetty), a student at the all-girls university next door to Gurukul. Karan becomes smitten with Kiran (Preeti Jhangiani), a girl he sees one night at a train station. All three know that if they're caught they'd be expelled, so they at first do not pursue their love interests.
Raj Aryan (Shah Rukh Khan) joins Gurukul as a music teacher. He challenges the status quo and slowly introduces changes that Narayan disapproves of. Raj is a strong believer of love, and when he learns the stories of the three boys, he encourages them to follow their hearts.
The boys take his advice, but are disappointed: Sameer discovers that Sanjana has a boyfriend; Vicky only makes Ishika dislike him when trying to woo her; Karan learns that Kiran is married to a pilot who is assumed dead. Raj tells the boys to not be disheartened, and tells them that his love, Megha (Aishwarya Rai) is dead, but he continues to love her and imagines that she is still by his side. Raj encourages the boys to continue to stay loyal to their loves.
One day Raj throws a party in Gurukul, inviting the students from the girls' school from next door as part of his plan to spread love in Gurukul. Narayan is furious and threatens to fire him. Raj then reveals he was a student at Gurukul years ago, and he fell in love with Megha, who was Narayan's only daughter.
Narayan had ensured that Raj was expelled without ever seeing his face, and afterward Megha committed suicide. Raj returned to Gurukul as a teacher in the hopes of changing Narayan's ways and honoring his love for Megha. Raj promises that before he leaves Gurukul, he will fill it with so much love that even Narayan will not be able to remove it.
Narayan accepts this challenge, and allows Raj to continue as a teacher for a while longer. Soon, inspired by Raj's openness and courage, Sameer, Vicky, and Karan one by one win over the girls they love. Narayan retaliates by tightening the rules of Gurukul, but the boys continue to break the rules, which encourages other students to do the same.
Narayan finally decides to expel the three, and Raj speaks up on their behalf, telling Narayan that he is the instigator and the boys should not be punished for it. Raj also says that he feels Narayan lost the battle, because his daughter left him and now Raj (who considered Narayan an elder) is leaving him. Raj's words make Narayan realise his mistake.
He publicly apologises to the students and steps down as the principal, allowing Raj to take over. Raj turns Gurukul into a love-filled university. In the end Raj, Narayan and a vision of Megha walk happily together towards the gates of Gurukul.