In 1947, John Nash (Russell Crowe) arrives at Princeton University as a new graduate student. He is a recipient of the prestigious Carnegie Prize for mathematics; although he was promised a single room, his roommate Charles Herman (Paul Bettany), a literature student, greets him as he moves in and soon becomes his best friend. Nash also meets a group of other promising math and science graduate students, Martin Hansen (Josh Lucas), Richard Sol (Adam Goldberg), Ainsley (Jason Gray-Stanford), and Bender (Anthony Rapp), with whom he strikes up an awkward friendship. Nash admits to Charles that he is better with numbers than he is with people.
The mathematics department chairman of Princeton informs Nash, who has missed many of his classes, that he cannot begin work until he finishes a thesis paper, prompting him to seek a truly original idea for the paper. A woman at the bar is what ultimately inspires his fruitful work in the concept of governing dynamics, a theory in mathematical economics. After the conclusion of Nash's studies as a student at Princeton, he accepts a prestigious appointment at the Massachusetts Institute of Technology (MIT), along with his friends Sol and Bender.
In 1953, while teaching a class on calculus at MIT, he places a particularly interesting problem on the chalkboard that he dares his students to solve. He is not particularly interested in teaching and his delusions even cause him to miss the class. When a student, Alicia Larde (Jennifer Connelly), comes to his office to discuss why he did not show up, she also asks him to dinner and the two fall in love and eventually marry.
On a return visit to Princeton, Nash runs into his former roommate Charles and meets Charles' young niece Marcee (Vivien Cardone), whom he adores. Nash is invited to a secret Department of Defense facility in the Pentagon to crack a complex encryption of an enemy telecommunication. Nash is able to decipher the code mentally, to the astonishment of other codebreakers. Here, he encounters the mysterious William Parcher (Ed Harris), who belongs to the United States Department of Defense. Parcher observes Nash's performance from above, while partially concealed behind a screen. Parcher gives Nash a new assignment to look for patterns in magazines and newspapers, ostensibly to thwart a Soviet plot. He must write a report of his findings and place them in a specified mailbox. After being chased by Soviet agents and an exchange of gunfire, Nash becomes increasingly paranoid and begins to behave erratically.
After observing this erratic behavior, Alicia informs a psychiatric hospital. Later, while delivering a guest lecture at Harvard University, Nash realizes that he is being watched by a hostile group of people, and although he attempts to flee, he is forcibly sedated and sent to a psychiatric facility. Nash's internment seemingly confirms his belief that the Soviets are trying to extract information from him. He views the officials of the psychiatric facility as Soviet kidnappers. At one point, he gorily tries to dig out of his arm an implant he received at an unused warehouse on the MIT campus which was supposedly used as a listening facility by the DoD.
Alicia, desperate and obligated to help her husband, visits the mailbox and retrieves the never-opened "top secret" documents that Nash had delivered there. When confronted with this evidence, Nash is finally convinced that he has been hallucinating. The Department of Defense agent William Parcher and Nash's secret assignment to decode Soviet messages was in fact all a delusion. Even more surprisingly, Nash's "prodigal roommate" Charles and his niece Marcee are also products of his mind.
After a series of insulin shock therapy sessions, Nash is released on the condition that he agrees to take antipsychotic medication; however, the drugs create negative side-effects that affect his sexual and emotional relationship with his wife and, most dramatically, his intellectual capacity. Frustrated, Nash secretly stops taking his medication and hoards his pills, triggering a relapse of his psychosis.
In 1956, while bathing his infant son, Nash becomes distracted and wanders off. Alicia is hanging laundry in the backyard and observes that the back gate is open. She discovers that Nash has turned an abandoned shed in a nearby grove of trees into an office for his work for Parcher. Upon realizing what has happened, Alicia runs into the house to confront Nash and barely saves their child from drowning in the bathtub. When she confronts him, Nash claims that his friend Charles was watching their son. Alicia runs to the phone to call the psychiatric hospital for emergency assistance. Nash suddenly sees Parcher who urges him to kill his wife, but Nash angrily refuses to do such a thing. After Parcher points a gun at her, Nash lunges for him, accidentally knocking Alicia and the baby to the ground. Alicia flees the house in fear with their child, but Nash steps in front of her car to prevent her from leaving. After a moment, he tells Alicia, "She never gets old"--referring to Marcee, who, although years have passed since their first encounter, has remained exactly the same age and is still a little girl. Realizing the implications of this fact, he finally accepts that although all three people seem completely real, they are in fact part of his hallucinations.
Caught between the intellectual paralysis of the antipsychotic drugs and his delusions, Nash and Alicia decide to try to live with his abnormal condition. Nash consciously says goodbye to the three delusional characters forever in his attempts to ignore his hallucinations and not feed "his demons". He thanks Charles for being his best friend over the years, and says a tearful goodbye to Marcee, stroking her hair and calling her "baby girl", telling them both he would not speak to them anymore. They still continue to haunt him, with Charles mocking him for cutting off their friendship, but Nash learns to ignore them.
Nash grows older and approaches his old friend and intellectual rival, Martin Hansen, now head of the Princeton mathematics department, who grants him permission to work out of the library and audit classes. Even though Nash still suffers from hallucinations and mentions taking newer medications, he is ultimately able to live with and largely ignore his psychotic episodes. He takes his situation in stride and humorously checks to ensure that any new acquaintances are in fact real people, not hallucinations.
Nash eventually earns the privilege of teaching again. In 1994, Nash is honored by his fellow professors for his achievement in mathematics, and goes on to win the Nobel Memorial Prize in Economics for his revolutionary work on game theory. Nash and Alicia are about to leave the auditorium in Stockholm, when Nash sees Charles, Marcee and Parcher standing and watching him with blank expressions on their faces. Alicia asks Nash, "What is it?" Nash replies, "Nothing. Nothing at all." With that, they both leave the auditorium.