In the future, robots known as Sentinels are exterminating mutants and their human allies. The Sentinels are near invincible as they possess Mystique's powers of transformation. This technology was made possible following research performed on Mystique when she was captured during the assassination of Dr. Bolivar Trask, creator of the Sentinels. A band of mutants, including Kitty Pryde, Colossus, Iceman, Bishop, Warpath, Blink and Sunspot, convene with Wolverine, Storm, Professor Charles Xavier, and Magneto in a hideout in remote China. Pryde sends Wolverine's consciousness back fifty years to 1973 to prevent Mystique from assassinating Trask, which led to her capture and revealed the threat that mutants could pose to normal humans.
At the X-Mansion in 1973, Wolverine encounters Xavier and Hank McCoy. Xavier, a broken man, has been overusing a serum that allows him to walk but suppresses his telepathy. Wolverine explains his mission and persuades Xavier to help free Magneto from a prison cell beneath The Pentagon, where he is being held for assassinating President John F. Kennedy. They rescue Magneto with the help of Peter Maximoff, a mutant with super speed.
In Washington, D.C., Trask unsuccessfully tries to sway Congress to gain support for his Sentinel program. Meanwhile, in Saigon, Mystique prevents William Stryker from appropriating a group of mutant G.I.s for Trask's research. Xavier, Magneto, Beast, and Wolverine fly to Paris to intercept Mystique, who is impersonating a North Vietnamese general to infiltrate the Paris Peace Accords. The group arrives as Mystique is about to kill Trask. Magneto tries to kill Mystique to ensure her DNA cannot be used for the Sentinels, but she escapes. The fight spills onto the street in view of the public, allowing Magneto and Mystique to escape.
Trask is saved, but the world is horrified by the existence of mutants. President Richard Nixon approves Trask's Sentinel program and arranges an unveiling ceremony. Trask's scientists recover Mystique's blood from the street. Meanwhile, Magneto—who has recovered his telepathy-blocking helmet—intercepts the prototype Sentinels in transit and laces their polymer-based frames with steel, enabling him to control them. At the mansion, Xavier stops taking his serum and slowly regains his telepathic powers, while losing the ability to walk. Through Wolverine, Xavier speaks to his future self and is inspired to work for peace between humans and mutants once again. He uses Cerebro to track Mystique, who is heading to Washington, D.C.
As Xavier, Wolverine, and Beast search for Mystique, Nixon unveils the Sentinel prototypes at the White House. Magneto commandeers the Sentinels and attacks the crowd, then sets the Robert F. Kennedy Memorial Stadium around the White House as a barricade. Nixon and Trask, accompanied by the Cabinet, Secret Service officers, and Mystique (disguised as a Secret Service member), are taken to a safe room. Wolverine and Beast try to stop Magneto, but he pits a Sentinel against them and then throws Wolverine into the Potomac River. In the future, the X-Men make their final stand as a large army of Sentinels attack the monastery. In 1973, Magneto pulls the safe room from the White House and prepares to kill Nixon and his Cabinet. Mystique, who is disguised as Nixon, incapacitates Magneto with a plastic gun. Xavier persuades Mystique to spare Trask and allows her and Magneto to flee. Mystique's actions are seen as a mutant saving the President, leading to the cancellation of the Sentinel program. Trask is arrested for trying to sell American military secrets. In the future, Mystique's actions save Xavier, Magneto, and Pryde just as a group of Sentinels reach them.
Wolverine wakes up back in the future to find Iceman, Rogue, Colossus, Pryde, Beast, Storm, Jean Grey, Scott Summers, and Xavier are all alive. He then proceeds to explain to Xavier about his experience. In 1973, Mystique, impersonating Stryker, takes custody of Wolverine, who has been fished out of the river.
In a post-credits scene, a crowd chants to En Sabah Nur, who is using telekinesis to build pyramids as four horsemen watch from nearby.
Cast: Hugh Jackman, James McAvoy, Michael Fassbender, Jennifer Lawrence, Halle Berry, Anna Paquin, Ellen Page, Peter Dinklage, Ian McKellen, Patrick Stewart