Rizwan Khan (Shah Rukh Khan) is a Muslim child who grew up with his brother Zakir (Jimmy Shergill) and his mother Razia Khan (Zarina Wahab) in a middle-class family in the Borivali section of Mumbai. Rizwan is different from other children, however. He has certain gifts, particularly a special ability to repair mechanical things. His difference leads to special tutoring from a reclusive scholar and extra attention from his mother, both of which lead to heightened jealousy from his brother Zakir, who eventually leaves his family for a life in the United States.
Despite this resentment, as an adult Zakir sponsors Rizwan to come and live with him in San Francisco after the death of their mother. It is at this time that Zakir's wife, Haseena (Sonya Jehan) diagnoses Rizwan with Asperger syndrome. Rizwan also begins to work for Zakir where Zakir runs 'Mehnaz Herbal Beauty Products, and in the process he meets a Hindu woman, Mandira (Kajol) and her young son, Sameer or Sam (Yuvaan Makaar), from a previous marriage. Mandira is a hairdresser. Despite Zakir's hostility to the match, Khan and Mandira marry and settle down in the fictional town of Banville. Both Mandira and Sameer take Rizwan's last name as their own. They also live next door to the Garrick family. Sameer is close to their young son, Reese (Kenton Duty and Michael Arnold) while Mark (Dominic Renda) is a reporter and Sarah (Katie A. Keane) is a friend of Mandira.
The Khans' perfect existence gets disrupted, however, after the September 11 attacks. Mark goes to cover the War in Afghanistan and dies there, much to both Sarah and Reese's distress. At the same time, the Khan family begins to experience post 9–11 prejudice in their community, and Reese begins to turn against an older Sam (Arjan Aujla) as well. One afternoon, an argument between them turns into a racially motivated schoolyard fight between Sameer and a gang of older students. Reese, acting on behalf of Sam, tries to stop the fight, but is held back. Sam dies of a ruptured spleen in the hospital. A shattered Mandira blames Rizwan for Sam's death, stating that Sam "died only because his last name was Khan." She then tells Rizwan that she no longer wants to be with him. When he asks her what he has to do to be together with Mandira, she sarcastically tells him that he has to tell the people of the United States and the President that his name is Khan and that he is not a terrorist.
Rizwan takes Mandira's request seriously, and thus sets out on a journey that takes him from one U.S. state to another, to first meet President George W. Bush(Brent Mendenhall) and later the new President-elect. During this quest, he travels to Wilhemina, Georgia, and befriends Mama Jenny and her son Joel. Later, in Los Angeles, he prays in a mosque and overhears violent rhetoric from Faisal Rahman (Arif Zakaria). He reports this to the FBI but there is no response at that moment. Later, while waiting in a crowd to meet President Bush and repeating again and again, "My name is Khan and I am not a terrorist," Rizwan is clubbed down, arrested and placed in a prison by police who misinterpret his statement thinking he said he was a terrorist.
While in the prison he is interrogated as a terrorist suspect and meets the psychiatrist Radha (Sheetal Menon) who believes he is innocent. He is later released after a media campaign by some Indian student reporters Raj (Arjun Mathur) and Komal (Sugandha Garg) and Bobby Ahuja (Parvin Dabas), who prove his innocence by unearthing his attempts to inform the FBI about Faisal Rahman. After his release, he returns to hurricane-hit Wilhemina to help Mama Jenny and her son. His efforts attract media attention, and numerous Muslims come to help as well.
At the same time, a remorseful Reese confesses to Mandira and reveals the identities of the gang who killed Sam. She informs Detective Garcia (Benny Nieves) who has been assisting her on the case, and he arrests the gang. Mandira later gets a call from Sarah to forgive Rizwan, "I've lost my husband; don't lose him."
Mandira realizes her error, she joins Rizwan in Georgia, and their love rekindles. However, at the moment she arrives, Rizwan is stabbed by one of Faisal Rahman's followers (Sumeet Raghavan), who accuses him of being a traitor to Islam, and Rizwan is rushed to the hospital. With Mandira's help, Rizwan survives and meets the new President-elect Barack Obama (Christopher B. Duncan) who tells him, "Your name is Khan and you are not a terrorist." The film concludes with Rizwan and Mandira going back home.