Twenty years ago, Professor Charles Xavier and Erik Lensherr 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 the boy 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, offering 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, Lensherr, 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, though Mystique takes a shot of the mutant cure, which was aimed at Magneto, leading him to 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, the two X-Men 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 the powerful alternate personality she calls "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 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, Beast injects Magneto with the cure, nullifying his powers, and Kitty Pryde and Jimmy save themselves from Juggernaut's attack. Army reinforcements arrive and attack Jean, awakening the Phoenix, who uses her powers to disintegrate the troops. As the Phoenix begins to destroy the facilities and mutants at Alcatraz, 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, stopping the devastating force, 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, suggesting that his powers are returning.
In a post-credits scene, Dr. Moira MacTaggert checks on a comatose patient who greets her with Xavier's voice, leaving her startled.