Most of the story is revealed as a flashback from prison cell of Veer Pratap Singh (Shahrukh Khan).
The narrative begins by showing Zaara Haayat Khan (Preity Zinta), an independent, carefree, and sprightly young Pakistani girl travelling to India. She is on her way to India with the ashes of her Sikh governess Bebe (a Punjabi word to denote mother or grandmother, but here used for Zaara's old governess). Before dying, Bebe (Zohra Sehgal) begs Zaara to fulfill her final wish - to take her ashes to India, to the holy Sikh city of Kiratpur, and scatter them in the Sutlej river, among her ancestors. Zaara decides to carry out Bebe's dying wish.
Upon reaching India, Zaara's bus meets with an accident causing it to overturn. An Indian Air Force pilot, Squadron Leader Veer Pratap Singh (Shahrukh Khan) comes to her rescue and with his help, Zaara completes Bebe's final rites. Veer convinces Zaara to return with him to his village to spend one day together. Zaara agrees and Veer takes her on a tour of India's Punjab. They visit Veer's home village on the day of the Lohri festival and meet Veer's relatives (Amitabh Bachchan and Hema Malini). With his father telling Veer that, in a dream he has seen Zaara becoming Veer's wife, Veer realizes he is falling in love with Zaara. Taking her to catch her train to Lahore, Veer is just waiting for the right time to tell Zaara about his feelings, but before he can do that they are met by Zaara's fiance, who has come looking for her, Raza (Manoj Bajpai). Just before she is to board the train, Veer confesses his love and then watches sadly as Zaara boards the train that will take her back to Pakistan. Veer gets no sense of Zaara's feelings, but as she is leaving he discovers he still has one of her silver anklets. She nods for him to keep it; both believe that this is the end of the road for their relationship and that they will probably never meet again.
On reaching Pakistan, Zaara realizes that she deep feelings for Veer, but that it is her duty to keep her family's honor and marry her fianc?, a wedding that will further her father's political career. But Zaara starts to see Veer's face everywhere and finally tells her mother that she has fallen in love with Veer. Zaara's maid and friend Shabbo calls Veer and tells him how miserable Zaara is without him, she dares him to come and take Zaara away; back to India. Veer who had told Zaara that he would give up his life for her, quits the Indian Air Force and goes to Pakistan to bring her back with him to India. Zaara's mother, Mariam Hayaat Khan (Kirron Kher), however, begs him to leave Zaara as Zaara's father, Jahangir Hayaat Khan (Boman Irani) is a high-profile politician whose reputation, and health, will be ruined if news gets out that his daughter is in love with an Indian. Veer respects this request and decides to leave for India but Raza, who is outraged by the shame Zaara has brought upon him, frames Veer and has him wrongly imprisoned on charges of being an Indian spy Rajesh Rathod.
The story moves forward by 22 years and Veer now meets Saamiya Siddiqui (Rani Mukerji), who is an idealistic Pakistani lawyer, whose mission in life is to pave the path for women's empowerment in Pakistan. The Pakistani government has decided to review the cases of some Indians, but stacking the deck against Siddiqui winning her first case, she has been given prisoner 786's case (Veer) a man who has not spoken a word to anyone in 22 years. Many view it as an impossible task as the man has been languishing in prison and has not spoken for the last 22 years.
Veer opens up to Saamiya and tells her that she can do anything for fighting his case except mention, much less subpoena, Zaara's family. The number 786 is considered to be a holy number in Islam, this convinces Saamiya that God has chosen Veer for some special purpose, and she becomes even more determined to exonerate him, restore his name and identity, and return him to his country.
After the prosecution presents it case, Saamiya realizes she must cross the boarder and find someone in Veer's village who can prove Veer's true identity. There, Saamiya meets Zaara- who had fled to India and has taken over running the girl's school after the deaths of Veer's parents, she has thought that Veer died on his bus that ran off a cliff, killing everyone on its way to India. Saamiya takes Zaara back to Pakistan to tell the court the truth about Veer's identity. The judge releases Veer from prison and apologizes on behalf of Pakistan. After Veer is finally released, he and Zaara bid goodbye to Saamiya and Pakistan at the Wagah border crossing, returning to their village together, where Veer, now the aging village elder, continues his father's dangerous habit of playing hockey with much younger men and boys.
But the bus in which she is travelling meets with an accident. It is at this point that she meets Veer. Their initial friendship starts off on a sour note, but before they realize it, they fall in love.