Plot Sunita (Jiah Khan) is a medical student working on a project about the human brain with her classmates. When she was denied access by her professor to the curious case of Sanjay Singhania (Aamir Khan), a man reported to have anterograde amnesia, because it is under criminal investigation, Sunita decides to investigate the matter herself.
It is later revealed that Sanjay loses his memory every 15 minutes. He uses a system of photographs, notes, and tattoos on his body to recover his memory after each cycle to remind himself of his mission: to avenge the death of his girlfriend Kalpana (Asin). He systematically kills the people who were involved in the murder. His main target is Ghajini Dharmatma (Pradeep Rawat), a notable social personality in the city, and the man directly responsible for Kalpana's death and Sanjay's condition.
Police inspector Arjun Yadav (Riyaz Khan) tracks Sanjay down to his apartment and knocks him unconscious. Yadav finds two diaries in which Sanjay has chronicled the events of 2005 and 2006. The film flashes back to 2005 as Yadav reads the diary. Sanjay Singhania is the chairman of the Air Voice mobile telephone company. In the course of business, he sends his men to meet Kalpana, a struggling model of Mumbai, about putting up a billboard above her apartment. The owner of Kalpana's advertising firm misinterprets this as a romantic advance and, in view of a possible lucrative Air Voice ad campaign, encourages Kalpana to accept the overture. Kalpana thinks of it as an innocent prank that may fetch her better modelling work and decides to act as Sanjay's girlfriend. Sanjay goes to confront Kalpana about this but falls in love with her at first sight. He hides his identity and introduces himself as Sachin, and the two begin spending time together. The diary ends with Sanjay proposing to Kalpana and promising himself that he will reveal his actual identity if she accepts.
When Yadav is about to read the 2006 diary, Sanjay awakes and attacks him, tying him up. Ghajini realizes that someone is trying to kill him but is unable to figure out who. Sunita visits Sanjay's flat and discovers Sanjay's plan to kill Ghajini. She takes both his diaries before finding Yadav, beaten and bound, and freeing him. Just then, Sanjay arrives, he remembers neither of them and chases them out. Yadav is hit by a bus as he flees in terror, and Sunita, believing Ghajini is the good guy in danger, informs him about Sanjay. Ghajini arrives at Sanjay's flat and destroys all of Sanjay's photographs and notes, as well as the tattoos on Sanjay's body, so that Sanjay is left with nothing to help him recover his memory.
Meanwhile, Sanjay discovers that Sunita had warned Ghajini and he goes to her dormitory to kill her, but Sunita calls the police and Sanjay is arrested. Back in her dormitory as Sunita reads the diaries, the film flashes back to 2006, where it is revealed that Kalpana had accepted Sanjay's proposal. When this diary ends abruptly, Sunita investigates further and discovers that Kalpana was travelling to Goa for a modelling assignment when she came upon 25 innocent young girls being trafficked. She had saved the girls with the help of some army soldiers on board, who named Ghajini as the ringleader of the racket. Outraged, Ghajini broke into Kalpana's apartment with his goons to kill her. When Sanjay arrived, he found Kalpana stabbed. Ghajini then hit Sanjay over the head with an iron rod. Sanjay's last sight was Ghajini brutally murdering Kalpana with the iron rod. Kalpana's last word to Sanjay was "Ghajini."
Sunita, now aware of the shocking truth, finds Sanjay in the hospital and tells him the truth. He flies into a heartbroken rage and tracks down Ghajini with Sunita's help. He fights off all of Ghajini's henchmen with a superior and anger-fueled strength. Ghajini, upon realizing Sanjay is too strong for him, flees. Sanjay's memory loss strikes again, and he forgets who Ghajini is. Ghajini takes this opportunity to stab Sanjay and taunt him with the grisly tale of how he murdered Kalpana. As he is about to make Sanjay relive the experience by killing Sunita in the same exact way, Sanjay recovers the memory of Kalpana's murder, and overpowers Ghajini in a flash of strength. He finally kills Ghajini, in the same way Ghajini had killed Kalpana.
The film ends with a still-amnesiac Sanjay volunteering at an orphanage named after Kalpana. Sunita gives him a gift that reminds him of his bond, with Kalpana, and Sanjay sees Kalpana by his side, finally at peace with himself.