During the early 1950s, Peter Appleton (Jim Carrey), an up-and-coming young screenwriter, is accused of being a Communist because he attended an antiwar meeting in college years before, a meeting he claims he only attended to impress a girl. In an instant, his new film is pushed back for a few months, the credit is given to someone else, his movie star girlfriend leaves him, and his contract with the studio is dropped.
His career in ruins, he gets drunk and accidentally drives his car off a bridge while trying to avoid an opossum. When he wakes up, his memory is lost and he is in a small town called Lawson after being fished out by Stan Keller (James Whitmore) who takes him to the local doctor named Doc Stanton (David Ogden Stiers). The townsfolk believe him to be Luke Trimble, one of the town boys killed in World War II 9 years before, and embrace him as a symbol of hope. "Luke" is at first mildly hesitant to embrace this life but he eventually settles in to "his old life", and with his "father" Harry (Martin Landau) and his "girlfriend" Adele Stanton (Laurie Holden), starts to restore The Majestic theater, an old movie house that had been closed because of hard times.
Meanwhile, in Washington, D.C., Congressional committee member Elvin Clyde (Bob Balaban) is convinced that Appleton's disappearance is proof that he is a Communist. No one in Hollywood knows about the accident. Clyde sends two federal agents to search for him. Back in Lawson, not everyone believes that "Luke" is back. Bob Leffert (Karl Bury), a one-handed soldier who knew the real Luke and did not like him not only is convinced that Peter is not Luke, he also believes that this stranger is setting the town up for more heartbreak. Others question where Luke has been for so long, and what he has been doing in the interim.
A few days later, the town throws a welcome home party for "Luke" headed by Mayor Ernie Cole (Jeffrey DeMunn). The town then asks him to play the piano which he used to do when he was a kid. But instead of playing one of the classics he was taught to play, he eventually falls into a roadhouse boogie tune. On his way home, he runs into Bob, who confronts him with the suspicions he has had about "Luke", and then punches him when Peter makes a remark about how the war must have changed him. Finally Peter, Harry, Adele and the rest of the townsfolk succeed in rebuilding The Majestic. In the event, Peter also convinces the town to finally display a memorial that President Franklin D. Roosevelt had commissioned for after the war, but that the town did not have the heart to erect.
Peter regains his memory when the Majestic shows a movie he wrote called "Sand Pirates of the Sahara." At the same moment, Harry has a heart attack before the reel change. Moments later, Doc reveals that Harry's lungs have flooded and that he will die soon. At Harry's death bed, Peter lets him die believing that he is really his son.
Immediately after the funeral, he tells Adele that he is not Luke. The whole town discovers the truth when federal agents Ellerby (Daniel von Bargen) and Saunders (Shawn Doyle) confront him publicly after two boys discover his car washed up on the beach. When Sheriff Cecil Coleman (Brent Briscoe) asks if he can help the federal agents with something, the agents present Peter with a summons to appear before Congress.
That night at the Majestic, Peter's agent advises him to "admit" and then denounce his past associations with the Communist Party, and presents him with a list of named "Communists" that he could read before the court to clear his name. Initially, Peter reluctantly agrees to this plan, but an argument with Adele and a letter he finds that was written as a sort of "goodbye letter" from the real Luke (voiced by Matt Damon) trying to explain to Adele that he knows he is dying for a real cause inspire Peter to instead confront the committee.
At the hearing headed up by Congressman Doyle (Hal Holbrook) which is televised with the citizens of Lawson also watching, Peter makes an impassioned speech about American ideals, which wins the crowd over. Fearing a political backlash, the lawmakers let him go free. Peter then finds out that it was in fact the girl that he went to the college meeting with years before that named him to the committee (it is revealed that she had since become a producer for Studio One).
Peter then returns to Lawson, fearing an unwelcome reception. To Peter's surprise, he receives a hero's welcome from the town's citizens, who have come to respect Peter as an individual. In an epilogue, Peter settles in Lawson, marries Adele, and they have a son.