Set in 1992, a young high school student, Charlie (Logan Lerman) who has been suffering from clinical depression setbacks since childhood has recently been discharged from a mental health care institution. Charlie is uneasy about beginning his freshman year of high school; he is shy and finds difficulty in making friends, but he connects with his English teacher, Mr. Anderson (Paul Rudd).
Charlie meets two seniors, Sam (Emma Watson) and her stepbrother Patrick (Ezra Miller) at a football game and they invite him to a party. Charlie unknowingly eats a weed brownie, gets high and discloses to Sam that the year before, his best friend committed suicide. He also walks in on Patrick and Brad (Johnny Simmons) the high school quarterback, kissing. Patrick tells Charlie that Brad does not want anyone to know he is gay, so Charlie agrees to keep it a secret. Sam realizes that Charlie has no other friends, so she and Patrick make a special effort to bring Charlie into their group. On their way home the three hear an unknown song on the radio, Sam instructs Patrick to drive through a tunnel, so she can stand up in the back of the pickup while the music blasts.
Sam needs to improve her SAT scores to have a better chance of being accepted to Pennsylvania State University, so Charlie offers to tutor her which improves her SAT score. At Christmas, Sam gives Charlie a vintage typewriter to thank him for his help. The two discuss relationships, and Charlie reveals he has never been kissed. Sam, though already involved with someone else, tells Charlie she wants his first kiss to be from someone who loves him, and kisses him.
At a regular Rocky Horror Picture Show performance, Charlie is asked to fill in for Sam’s boyfriend Craig, who is not there. Their friend Mary Elizabeth (Mae Whitman) is impressed and asks Charlie to the Sadie Hawkins dance. The two enter into an unsatisfactory relationship. Finally, at a party, when Charlie is dared to kiss the prettiest girl in the room, he chooses Sam, upsetting both her and Mary Elizabeth. Patrick recommends Charlie stay away from the group for a while, and the isolation causes him to sink back into depression. He experiences flashbacks of his Aunt Helen (Melanie Lynskey) who died in a car accident on his seventh birthday.
Brad shows up to school with bruises on his face after having been caught by his father having sex with Patrick. Brad claims that he was jumped and beaten up, and distances himself from Patrick, calling him a “faggot”. After Patrick punches him, Brad’s friends begin beating Patrick, but Charlie forcefully intervenes, then blacks out. When he recovers he finds that he has bruised knuckles and Brad’s friends are on the floor, incapacitated. Sam and Patrick express their gratitude to Charlie, and the three become friends again.
Patrick tries to cope with what happened with Brad, and at one point kisses Charlie, but immediately apologizes afterwards. Charlie keeps getting worse after the blackout. Sam is accepted into Penn State, and breaks up with Craig on prom night after learning he has been cheating on her. The night before she departs, she brings Charlie to her room. They confide in each other and kiss, but when Sam touches Charlie’s thigh, he experiences a momentary flashback of his Aunt Helen, which he passes off as nothing, and they continue to kiss. After she leaves for college in the morning his emotional state deteriorates and his flashbacks worsen. He calls his sister blaming himself for Helen’s death, and admits he may have wanted it to happen. His sister realizes he is in trouble and calls the police. Charlie passes out as they burst through the door and comes to in a hospital, where psychiatrist Dr. Burton (Joan Cusack) manages to bring out Charlie’s repressed memories, which reveal that his aunt sexually abused him.
The night Charlie is released from the hospital he is visited by Sam and Patrick. Sam explains what college life is like, and that she has found “The Tunnel Song” – “Heroes” by David Bowie. The three revisit the tunnel, where Charlie kisses Sam again, and he stands up in the back of the truck. Charlie acknowledges that he feels alive and in that moment – “We are infinite”.