At the White House, brainwashed teleporting mutant Nightcrawler attempts to assassinate the President of the United States but fails and escapes. Meanwhile, Wolverine returns to Professor Xavier's school for mutants, while fellow X-Men Storm and Jean Grey find Nightcrawler with the help of the mutant-tracking machine Cerebro.
Xavier and Cyclops visit Magneto in his plastic prison cell, inquiring about the assassination attempt, and Xavier discovers that military scientist Colonel William Stryker has been extracting information about Cerebro from a brainwashed Magneto using an injectable drug. Stryker and his assistant Yuriko Oyama capture Cyclops and Xavier and raid Xavier's school. Wolverine kills many of Stryker's men, while Colossus helps most of the students escape through hidden tunnels. Rogue, Iceman, Pyro, and Wolverine attempt to escape until Wolverine is confronted by Stryker, who fails to shed light on Wolverine's past. Iceman helps Wolverine escape, but Stryker's soldiers succeed in sedating six students and breaking into Cerebro. During a confrontation with the mutant-hating Stryker, Xavier learns Stryker is behind the plot to assassinate the president.
Impersonating Senator Robert Kelly and Yuriko, the shape-shifting Mystique gains information about Magneto's prison and helps him escape while also discovering schematics for another Cerebro. Wolverine, Rogue, Iceman, and Pyro visit Iceman's parents in Boston. Responding to a 9-1-1 call from Bobby's brother Ronny, the police arrive just as the group is leaving. Pyro uses his fire-projection power to fend off the police but when he starts attacking the incoming police cars, Rogue stops him by briefly draining his life force.
The X-Jet arrives to pick the group up and is targeted by two Air Force F-16 fighter jets. They are hit by a missile, but Magneto saves their jet from crashing. Magneto informs them that Stryker orchestrated the attack on the president to provide rationale to raid Xavier's school in order to steal Cerebro's parts, and plans to connect Xavier to another Cerebro rebuilt at a secret base. The X-Men decide to team up with Magneto and Mystique to stop Stryker. Jean reads Nightcrawler's mind and determines that Stryker's base is inside the dam at Alkali Lake.
Through his son, Jason, Stryker gains control over Xavier, who is brainwashed to use the second Cerebro to find and kill all mutants. Mystique infiltrates Stryker's base by impersonating Wolverine, and Storm and Nightcrawler search for the students. Jean, Magneto, and Mystique are attacked by a brainwashed Cyclops while trying to rescue Xavier, and cause damage to the generators that keep the dam from collapsing in the process. The force of Jean's telekinetic blast clashing with Cyclops' optic blast awakens him from his brainwashing, but cracks the dam. Wolverine finds Stryker in an adamantium smelting room, where he recovers some of his memory. Wolverine fights and kills Yuriko, and finds Stryker on a landing pad, where Stryker bargains for his life by offering to reveal Wolverine's past. Wolverine refuses, and binds Stryker in chains.
Storm and Nightcrawler find the students, while Magneto and Mystique kill the rest of Stryker's men. Magneto stops Jason and Xavier from using Cerebro to kill mutants. Disguised as Stryker, Mystique uses Jason to convince Xavier to kill all humans instead; she and Magneto, along with new initiate Pyro, use Stryker's helicopter to escape Alkali Lake, after chaining Stryker to concrete rubble. Nightcrawler teleports Storm inside Cerebro, where she creates a snowstorm to break Jason's concentration and free Xavier from his control.
The X-Men flee the base as water engulfs it, and discover that Magneto, Mystique, and Pyro have escaped on the helicopter. Iceman and Rogue arrive with the X-Jet and get everyone on board. The dam bursts, flooding the landscape and killing Stryker. A malfunction aboard the X-Jet prevents it from taking off; Jean ultimately sacrifices herself and uses a telekinetic wall to shield them from the flood. She uses her leftover power to activate the X-Jet's primary engines and drops the torrent of water down on herself, which presumably drowns her.
The X-Men give the President Stryker's files, and Xavier warns him that humans and mutants must work together to build peace. Back at the school, Xavier, Cyclops, and Wolverine remember Jean, and Wolverine tells Cyclops that Jean chose Cyclops over him. As the film ends, Xavier states he believes everything will be alright, while a Phoenix-like shape forms beneath Alkali Lake.
Who do Xavier, Cyclops, and Wolverine remember?
Jean