In 1944, in a German camp in occupied Poland, during World War II, Nazi scientist Dr. Klaus Schmidt observes young Erik Lehnsherr bend a metal gate with his mind after the child is separated from his mother. In his office, Schmidt orders Lehnsherr to move a coin on his desk, and kills the boy's mother when Lehnsherr fails to do so. In anger, Lehnsherr's magnetic powers manifest, killing two guards and destroying the room. Meanwhile, at a mansion in Westchester County, New York, child telepath Charles Xavier meets young shapeshifter Raven, whose natural form is blue-skinned and scaly. Overjoyed to meet someone else who is "different", he invites her to live with his family as his foster sister.
In 1962, Lehnsherr is tracking down Schmidt, while Xavier graduates from the University of Oxford with a thesis about mutation. In Las Vegas, CIA officer Moira MacTaggert follows U.S. Army Colonel Hendry into the Hellfire Club, where she sees Schmidt (now known as Sebastian Shaw), with mutant telepath Emma Frost, cyclone-producing Riptide and teleporter Azazel. Threatened by Shaw and teleported by Azazel to the Joint War Room, Hendry advocates deployment of nuclear missiles in Turkey. Shaw, an energy-absorbing mutant, later kills Hendry.
MacTaggert, seeking Xavier's advice on mutation, takes him and Raven to the CIA, where they convince Director John McCone mutants exist and Shaw is a threat. Another CIA officer sponsors the mutants and invites them to the secret "Division X" facility. MacTaggert and Xavier find Shaw as Lehnsherr is attacking him, and rescue Lehnsherr from drowning as Shaw escapes. Xavier brings Lehnsherr to Division X, where they meet young scientist Hank McCoy, a mutant with prehensile feet, who believes Raven's DNA may provide a "cure" for their appearance. Xavier uses McCoy's mutant-locating device Cerebro to seek recruits against Shaw. Xavier and Lehnsherr recruit stripper Angel Salvadore, followed by cabdriver Armando Muñoz, Army prisoner Alex Summers, and Sean Cassidy, who code-name themselves Darwin, Havok, and Banshee, respectively. Raven dubs herself Mystique. Xavier and Lehnsherr also approach Wolverine, who rudely declines.
When Frost meets with a Soviet general in the USSR, Xavier and Lehnsherr capture Frost and discover Shaw intends to start World War III and trigger mutant ascendency. Azazel, Riptide and Shaw attack Division X, killing everyone but the mutants, whom Shaw invites to join him. Angel accepts; when Havok and Darwin retaliate, Shaw kills Darwin.
Xavier takes the mutants to his family mansion for training. In Moscow, Shaw compels the general to have the USSR install missiles in Cuba. Wearing a helmet that foils Xavier's telepathy, Shaw follows the Soviet fleet in a submarine to ensure the missiles break a US blockade.
Raven, thinking McCoy likes her in her natural form, tells him not to use the cure. When she later attempts to seduce Lehnsherr by taking the forms of various women, Lehnsherr instead tells her she is beautiful in her blue mutant form. McCoy uses the cure on himself but it backfires, giving him blue fur and leonine aspects. With McCoy piloting, the mutants and MacTaggert take a jet to the blockade line, where Lehnsherr uses his magnetic power to lift Shaw's submarine from the water and throw it on land. During the ensuing battle, Lehnsherr seizes Shaw's helmet, allowing Xavier to immobilize Shaw. Lehnsherr tells Shaw he shares Shaw's exclusivist view of mutants but, to avenge his mother, he kills Shaw—over Xavier's objections—by forcing the Nazi coin from his youth through Shaw's brain.
Fearing the mutants, the U.S. and Soviet leaders order both fleets to fire missiles at them, which Lehnsherr turns back in mid-flight. MacTaggert tries to stop Lehnsherr by shooting him but he deflects the bullets, one of which hits Xavier in the spine. Lehnsherr rushes to help Xavier and, distracted, allows the missiles to fall harmlessly into the ocean. Parting with Xavier over their differing view on the relationship between humans and mutants, Lehnsherr leaves with Angel, Riptide, Azazel, and Mystique. Later, a wheelchair-bound Xavier and his mutants are at the mansion, where he intends to open a school. MacTaggert promises never to reveal his location and they kiss; at a CIA debriefing later, she says she has no clear memory of recent events. Elsewhere Lehnsherr, now calling himself "Magneto", frees Frost from confinement.