At a German concentration camp in occupied Poland during 1944, young Erik Lensherr is separated from his parents by Nazi guards. The child's desperate mind remarkably bends a metal gate until a guard knocks Lensherr unconscious (a recreation of the opening scene of the first X-Men movie). Scientist Sebastian Shaw, who has observed this through a window, calls Lensherr up to see him. Placing a metal coin on a desk, he orders Lensherr to use his power to move it. When Lensherr cannot, despite his best efforts, Shaw shoots and kills Lensherr's mother in front of him. In his rage, Lensherr's out-of-control magnetic power kills the two guards and destroys two rooms, to Shaw's delight. Shaw tells Lensherr that they will "have fun" developing the boy's power.
Around this same time, in Westchester County, New York, mansion, a young Charles Xavier meets a young, shape-shifting girl named Raven, disguised as his mother, who is looking through the fridge for food. Using his mind to talk to Raven, Xavier accuses his "mother" of being an imposter, and asks what it has done with his real mother, as she would not make him a sandwich or hot chocolate. Raven shifts back to her normal, blue-skinned form. Overjoyed to meet someone else "different" like him, he says she can come live with his family.
In Switzerland in the movie's present-day of 1962, Lensherr forces a banker (by ripping out one of the metal fillings in his mouth) to trace a bar of Nazi gold to Shaw's address in Argentina. In a tavern there patronized by former German soldiers, Lensherr kills three men as he learns that Shaw has a yacht in Florida. Meanwhile, in England, Oxford University graduate Xavier is publishing his thesis on mutation; his foster sister Raven, a waitress, lives with him. Simultaneously in Las Vegas, Nevada, CIA agent Moira MacTaggart follows U.S. Army Colonel Hendry into the Hellfire Club, where she sees Shaw, Emma Frost, Riptide and Azazel. Shaw calmly threatens Hendry, telling him that the Colonel should reverse his position on advocating that the U.S. install nuclear missiles in Turkey, a move the government had previously avoided so as not to provoke war with the Soviet Union. When Hendry refuses, Shaw has Riptide demonstrate his power to conjure tornadoes from thin air and hurls Hendry into a wall. Convinced, Shaw has Azazel teleport Hendry to the US president's War Room, where he supports the missile placement in Turkey.
Shaw later meets with Colonel Hendry on his yacht, and refuses to give Hendry his money, at which point Hendry pulls out a grenade and threatens to pull the pin. Shaw takes the grenade and pulls the pin himself, and absorbs the blast (at which point we now learn that Shaw is a mutant, and absorbs energy, which also keeps him young), then taps Hendry, expelling the grenade's energy into the Colonel, destroying him.
MacTaggart seeks Xavier's advice on mutation, and takes Xavier and Raven to the CIA to convince the chief that Shaw is a threat. After convincing them that mutants exist, they are to be taken to a covert facility, but first Xavier insists they track down Shaw. Shaw is aboard his yacht relaxing with Frost and Riptide when Lensherr appears. Frost uses her telepathy to pacify Erik and pushes him overboard.
Lensherr attacks Shaw, using the anchors and chains of the yacht to tear the boat apart. When Shaw escapes in a submarine hidden below the upper decks of the boat, Lensherr tries to stop him, but Xavier stops him so that he does not drown. Lensherr joins Xavier and Raven at the CIA facility, where they meet Hank McCoy, another mutant that Xavier accidentally outs. McCoy and Xavier use a prototype Cerebro to locate mutants and recruit several of them to train to stop Shaw. Upon the recruiting process, we also see Xavier and Lensherr walk up to Logan (Wolverine) in a bar and introduce themselves. He tells them to go to hell, and they walk off.
Shaw plans to meet with a Russian general, but sends Frost instead, who is then captured by Xavier and Lensherr. Xavier taps into Frost's mind and finds out that Shaw wants to start a nuclear war between the US and Russia in order to wipe out all normal humans. The facility is attacked by Azazel, Riptide and Shaw, with all the guards being killed. Shaw offers the new mutants to a place on his side, but most of them refuse. He recruits Angel after offering and kills Darwin by forcing him to ingest a massive amount of energy when he tries to fight back. When Lensherr and Xavier return they all go to Xavier's mansion and begin to train, though Raven is conflicted about hiding her natural form. Hank creates a vaccine that is supposed to turn his and Raven's appearance normal, however, when Hank takes it his mutant physical features are enhanced; he now has blue skin, blue fur and is several times stronger.
President Kennedy institutes a blockade. Shaw travels with the Russian fleet to ensure that the missiles get to Cuba. Xavier, MacTaggart and Lensherr fly to the blockade to stop the fleets from engaging. Shaw uses the sub's nuclear core to charge himself up and a helmet to block Xavier's telepathy. While Azazel kills the crew of the Russian missile ship, Xavier uses his powers to make a Russian officer on one of the escort ships fire a missile and destroy the cargo ship carrying the Soviet weapons before it crosses the line.
Lensherr pulls Shaw's submarine from the water, but an attack forces the jet and submarine to crash. Lensherr finds Shaw in the sub's reactor room. The two battle furiously; Lensherr tries to overcome Shaw with the metal in the room but Shaw counters with his own telekinesis and pins Lensherr to the wall. Lensherr plucks Shaw's helmet from his head with a length of cable and Xavier takes control of Shaw. Lensherr puts on the helmet to block out Xavier and admits that he agrees with everything Shaw believes about mutants and humans. Eric kills him by slowly forcing the coin that Shaw taunted him with through his brain while Xavier screams, experiencing the act himself. Eric exits the wrecked submarine with Shaw's body and announces to his fellow mutants that the humans in both fleets are their real enemies and that the mutants should band together to fight them. Xavier pleads with Eric to end the campaign but he fails.
The two fleets fire their missiles at the mutants, but Lensherr, now fully in control of his abilities, stops the missiles in mid-flight and then turns them on the fleet. In the ensuing fight Xavier manages to distract Lensherr, but when MacTaggart fires at Lensherr he deflects the bullets, with one paralyzing Xavier.
Lensherr takes Raven, Angel, Riptide and Azazel and leaves. Xavier, now confined to a wheelchair for the rest of his life, and the mutants return to the mansion, where he will open a school. He wipes MacTaggart's memory. Lensherr breaks Frost out of the CIA headquarters, and in his new uniform he tells Frost to call him "Magneto."