Twenty-year-old Will Hunting (Matt Damon) of South Boston is a self-taught genius, though he works as a janitor at MIT and spends his free time drinking with his friends, Chuckie, Billy, and Morgan. When Professor Gerald Lambeau posts a difficult mathematics problem on a blackboard as a challenge for his graduate students, Will solves the problem anonymously, stunning both the students and Lambeau. As a challenge to the unknown genius, Lambeau posts an even more difficult problem. Will flees when Lambeau catches him writing the solution on the blackboard late at night. At a bar, Will meets Skylar (Minnie Driver), a British woman about to graduate from Harvard College, who plans on attending medical school at Stanford.
The next day, Will and his friends fight a gang who used to bully Will as a child. Will is arrested after he attacks a responding police officer. Lambeau sits in on his court appearance and watches Will defend himself. He arranges for him to forgo jail time if he agrees to study mathematics under Lambeau’s supervision and participate in therapy sessions. Will tentatively agrees, but treats his therapists with mockery. In desperation, Lambeau calls on Dr. Sean Maguire, his college roommate, who now teaches psychology at Bunker Hill Community College. Unlike other therapists, Sean actually challenges Will’s defense mechanisms, and after the first session where Sean threatens Will after he insults his deceased wife and a few unproductive sessions, Will begins to open up.
Will is particularly struck by Sean’s story of how he met his wife by giving up his ticket to the historic game six of the 1975 World Series, after falling in love at first sight. Sean does not regret his decision, even though his wife died of cancer. This encourages Will to build a relationship with Skylar, though he lies to her about his past and is reluctant to introduce her to his friends or show her his rundown neighborhood. Will also challenges Sean to take an objective look at his own life, since Sean cannot move on from his wife’s death.
Lambeau sets up a number of job interviews for Will, but Will scorns them by sending Chuckie as his “chief negotiator”, and by turning down a position at the NSA with a scathing critique of the agency’s moral position. Skylar asks Will to move to California with her, but he refuses and tells her he is an orphan, and that his foster father physically abused him. Will breaks up with Skylar and later storms out on Lambeau, dismissing the mathematical research he has been doing. Sean points out that Will is so adept at anticipating future failure in his interpersonal relationships that he deliberately sabotages them in order to avoid emotional pain. Chuckie likewise challenges Will over his resistance to taking any of the positions he interviews for, telling Will he owes it to his friends to make the most of opportunities they will never have, even if it means leaving one day without looking back. He then tells Will that the best part of his day is a brief moment when he waits on his doorstep thinking Will has moved on to something greater.
Will walks in on a heated argument between Sean and Lambeau over his potential. Sean and Will share and find out that they were both victims of child abuse. Sean helps Will to see that he is a victim of his own inner demons and to accept that it is not his fault, causing him to break down in tears. Will accepts one of the job offers arranged by Lambeau. Having helped Will overcome his problems, Sean reconciles with Lambeau and decides to take a sabbatical. Will’s friends present him with a rebuilt Chevrolet Nova for his 21st birthday. Later, Chuckie goes to Will’s house to pick him up, only to find that he is not there, much to his happiness. Will sends Sean a letter telling him to tell Lambeau that he had to go “see about a girl”, revealing he passed on the job offer and instead is heading to California to reunite with Skylar.