Twenty years ago, Professor Charles Xavier and Erik Lehnsherr meet young Jean Grey at her parents' house to invite her to join their school. Ten years later, the industrialist father of Warren Worthington III discovers his son is a mutant as Warren tries to cut off his wings.
In the present, Worthington Labs announces it has developed an inoculation to suppress the X-gene that gives mutants their abilities, and offer the "cure" to any mutant who wants it. The cure is created from the genome of a young mutant named Jimmy, who lives at the Worthington facility on Alcatraz Island. While some mutants are interested in the cure, including the X-Men's Rogue, many others are horrified by the announcement.
In response to the news, Lehnsherr, now known as the X-Men's adversary Magneto, reestablishes his Brotherhood of Mutants with mutants who oppose the cure, warning his followers that the cure will be forcefully used to exterminate the mutant race.
With help from Mystique and Pyro, Magneto recruits Callisto, Juggernaut, and Multiple Man, along with a few others. They attack the team holding Mystique to free her. Mystique trying to save Magneto takes a shot of the mutant cure, turning her into a human. Magneto thanks her and his hatred for humans makes him abandon her. Meanwhile, Cyclops, still distraught over the loss of his fiancée Jean Grey, drives to her resting location at Alkali Lake. Jean appears to Cyclops but, as the two kiss, Jean starts disintegrating her lover.
Sensing trouble, Xavier sends Wolverine and Storm to investigate. When they arrive, they find telekinetically floating rocks, Cyclops' glasses, and an unconscious Jean. Cyclops himself is nowhere to be found.
When they return to the X-Mansion, Xavier explains to Wolverine that when Jean sacrificed herself, she unleashed a powerful alternate personality called the "Phoenix", which Xavier had telepathically repressed, fearing the Phoenix's destructive potential. Wolverine is disgusted to learn of this psychic tampering with Jean's mind but, once she awakens, Wolverine realizes she killed Cyclops and is not the Jean Grey he once knew. The Phoenix awakens, knocks out Wolverine, and escapes to her childhood home.
Magneto learns of Jean's resurrection through Callisto, and the X-Men arrive at the Grey home at the same time as the Brotherhood. Magneto and Xavier vie for Jean's loyalty until the Phoenix resurfaces. She destroys the house and disintegrates Xavier before leaving the property with Magneto. The Brotherhood decides to strike Worthington Labs, and Magneto uses his powers to move the Golden Gate Bridge so he can connect Alcatraz to the San Francisco mainland and facilitate the attack.
The X-Men confront the Brotherhood, despite being significantly outnumbered, and arrive just as the military troops, who thus far had been neutralizing the attacking mutants, are overwhelmed by the Brotherhood.
During the fight, Kitty Pryde saves Jimmy from the Juggernaut, and Beast injects Magneto with the cure, nullifying his powers. Army reinforcements arrive and attack Jean, awakening the Phoenix, who disintegrates the troops in retaliation. As the Phoenix begins to destroy Alcatraz and anyone within range of her powers, Wolverine realizes that, due to his healing factor, only he can approach the Phoenix. Wolverine approaches her, and Jean momentarily gains control, begging him to save her. Wolverine fatally stabs Jean, destroying the Phoenix, but mourns her death.
Sometime later, Xavier's school is still operating with Storm as headmistress, and the President of the United States appoints Beast as ambassador to the United Nations. Rogue reveals to Bobby Drake that she has taken the cure, while Magneto sits alone at a chessboard in a San Francisco park. As he gestures toward a metal chess piece, it wobbles slightly.
In a post-credits scene, Dr. Moira MacTaggert checks on a comatose patient who greets her with Xavier's voice, leaving her startled.