Patrick Stewart's Charles Xavier recounts how humans created sentinels to hunt and kill mutants. While they at first only hunted mutants, they later began targeting humans who held a probability of becoming mutants. The resulting events have created an apocalyptic wasteland in which only a handful of mutants have survived, facing extinction should they be found by the sentinels.
Three strange objects are ejected from a large airship and crash to the ground. Warpath realizes that the sentinels have found them and leaves with Blink to warn the others, including Colossus, Sunspot, Bishop, Iceman, and Kitty Pryde. Bishop immediately requests that Sunspot give him some energy in the form of fire, which he absorbs and channels into his advanced rifle. Bishop takes off with Kitty Pryde as the others form a ring of defense against the invading sentinels. The sentinels drill into the mutant's base, their bodies having the ability to rearrange into different forms and tools. They break through and Sunspot engages the first, drenching it in flames. Colossus engages the second, getting knocked to the ground by the towering sentinel. Warpath tries to help but is knocked away. The third sentinel intercepts Bishop and Kitty. Bishop fires a large energy blast at the sentinel, barely affecting it. Blink appears via the use of her portals and makes an exit for the two fleeing mutants. She then opens up a portal for Iceman to assist against their foe. Iceman uses his ice slide to outmaneuver the pursuing sentinel, encasing it in a thick wall of ice. Kitty and Bishop arrive at a safe room, where Kitty has Bishop lie on a table. She puts her hands around his head as he loses consciousness.
Meanwhile, the sentinels are getting the upper hand in the fight. When Colossus throws a punch that is caught by a sentinel, Colossus' metal skin begins to form over the sentinel as well. It becomes clear that the sentinels are able to absorb and replicate mutant powers. Both Colossus and Warpath are killed by the sentinel they are fighting. The sentinel fighting Sunspot begins to form a protective cocoon of ice around itself, using the powers of Iceman. It breaks through the gout of flames keeping it at bay and strangles Sunspot to death. Subsequently, the sentinel fighting iceman encases itself in fire to melt itself free from the ice, using the powers of Sunspot. It breaks through the ice and grabs Iceman by the neck. Iceman's frozen head slides across the floor and the sentinel steps on it. The sentinels proceed to melt down the door to the room Kitty and Bishop are hiding in. But as they enter, Kitty says "Too late, assholes!" Just before the sentinels can kill the two, everyone in the scene disappears.
The remaining future mutants, Wolverine/Logan, Storm, Professor X/ Charles Xavier, and Magneto/Erik Lensherr, disembark from their jet to greet the group of mutants that we just saw die and subsequently disappear. It is revealed that Kitty Pryde's mutation has evolved to allow her to send someone's consciousness back through time. During the sentinel assault in the previous scene, Bishop's consciousness was sent back through time to his younger body. He warned the others of the impending sentinel assault so they could leave before the sentinels ever arrived. Bishop and Kitty disappeared from the opening sequence because that reality had been erased and the time line altered. Kitty explains to the four arrivals that they have done this many times before. Each time the sentinels attack: Warpath spots them, the mutants make a line of defense to buy some time, Kitty sends Bishop back through time with the warning of the attack, and the mutants of the past flee before the attack can ever take place.
Professor Xavier then exclaims that he is aware and has come up with a plan to send his own consciousness back through time to the point when the sentinels were first unleashed. We learn that in 1973, Mystique assassinated Bolivar Trask, the creator of the sentinel program. This murder spurred the humans to further the sentinel program. Mystique is later captured and it is through the study of her DNA that the sentinels of the future are born. Her unique DNA allows the sentinels to adapt mutant powers for their own use. Professor Xavier plans to go back in time to stop the assassination of Bolivar Trask and in turn, prevent the anti-mutant tide that leads to the creation of the sentinels. Kitty says, however, that she can only send someone back a couple of weeks or a month into the past, not decades. She warns that the mind can only be stretched so far without breaking. Wolverine volunteers to go back, his healing ability allowing him to survive the procedure. He must go to the past and convince a broken Charles Xavier to take up arms and work with the man that he hates, Erik Lehnsherr. It is only together that they can find Mystique and prevent her from assassinating Trask. Kitty carries out the procedure, warning Logan that while his consciousness is in the past, his body will stay in the future. Only when his consciousness returns from the past will the timeline change. His mind staying in the past is contingent upon his body existing in the future and Kitty remaining at his side. Logan will have a limited amount of time before they are found by the sentinels of the future; he must complete his mission before then or all will be lost.
Logan wakes up and finds himself in bed with a woman. He looks outside and realizes that the procedure has worked; it is 1973. Seconds later, three thugs burst through the door as Logan is getting dressed. Apparently, he was supposed to be guarding the someone's daughter instead of sleeping with her. He asks if they would believe that he was from the future at which they scoff. He extends his bone claws and the henchmen pull out guns and begin shooting him. He heals from his wounds and proceeds to take out the men, stealing their car.
The next scenes introduces us to Bolivar Trask, who is trying to convince members of Congress to fund his sentinel program. He tries to convince the panel that mutants are a threat to humanity. The committee does not share the Trask's belief,, stating that if mutants have been among humankind for some time now, they have existed peacefully alongside their fellow humans. They decide to not provide the funding.
In a US military camp in Vietnam, a high-ranking army officer walks into a segregated tent to find a man named William Stryker preparing to take a group of mutants into custody. The army officer says that these men are going home. Stryker flashes around a document claiming to be part of a special outfit who is transferring the mutants to a Trask Industries facility, informing the army officer that he doesn't have jurisdiction. The officer counters that he does, transforming into the shape-shifter Mystique. She begins to take out all of the men in tent in hand-to -and combat with some assistance from the mutants. Before she can kill Stryker, one of the mutants intervenes and knocks Stryker unconscious. This mutant is Havok from the previous film in the series and he asks about the whereabouts of Magneto. Mystique responds that she's on her own now. The mutants board a plane home while Mystique walks away in disguise, claiming that there is still work to be done.
Logan drives up to the dilapidated and overgrown Xavier mansion. Hank, also known as Beast, answers the door in his human form. Logan asks to see Charles but is rebuffed by Hank. He forces his way in, exclaims that he and Hank will be good friends in the future, and punches Hank right in the face. Blue fur appears on Hank as he transforms into the Beast. He begins to throw Logan around, giving him a good beating before being stopped by Charles. Despite being paralyzed by a bullet to his spine, he's walking around normally. Logan pleads his case to Charles only to be ridiculed by the drunken and disheveled young man. Logan asks Charles to read his mind, but Charles can't. Beast/Hank explains that he developed a serum to control his mutation and keep his beast form at bay. From this, he then developed a serum to cure Xavier's paralysis. A side effect of taking the drug, however, left Charles unable to use his mutant ability to read and control minds. Logan is able to convince him nonetheless, after revealing secrets of Xavier's past that he had never told anybody. Charles refuses to help Logan and it is clear that he is a broken man, depressed and filled with the guilt of losing his friends, students, and most of all losing Raven/Mystique. Eventually, he agrees to assist Logan for the sake of Raven herself. One problem still exists: they need to enlist the help of Magneto, whom Charles absolutely loathes. Magneto is being kept underneath tons of concrete in a prison at the Pentagon, having already served 10 years in prison for the alleged killing of John F. Kennedy.
We cut to Mystique disguising herself as Bolivar Trask to gain entrance to his personal office. She pores through documents and discovers that Trask has been experimenting on mutants and killing them. She pulls a file regarding an event at which Trask will be present with members of the Vietnamese government and asks Trask's secretary to type up his itinerary.
To break Magneto out of prison, the group enlists the help of Pietro Maximoff/ Quicksilver. He uses his ability of ultrafast movement to almost instantly do whatever he chooses. The group arrives at the Pentagon and Hank uses a piece of equipment to interfere with the surveillance cameras. Quicksilver steals a guard's uniform and makes his way to Magneto's prison, where he vibrates his hands at a resonant frequency of the glass ceiling to shatter it. The two make their way to a kitchen when they confront Logan and Charles. Charles punches Erik the moment he sees him with Erik commenting that it was nice to see him. Just then guards burst through the door and draw their weapons. Erik asks Charles to use his powers to stop the men but Charles replies that he can't. The guards open fire and Erik readies to kill them, ignoring Charles' pleas for him not to kill the guards. Before anything can happen, we experience a scene from the perspective of Quicksilver with time almost standing still. He uses his enhanced speed to comically knock out the guards and redirect the bullets in flight.
Charles, Erik, Hank, and Logan are aboard a plane en route to Paris to stop Raven from assassinating Trask. Things get heated between Charles and Erik as Charles accuses Erik of taking the things that were most precious away from him. Erik in turn asks where Charles was when they came for Angel, Banshee, Azazel, and Emma Frost. He shouts that they were taken, experimented on and killed and that both he and Charles were supposed to protect them. (It is implied that Trask was responsible.) During this heated exchange, Erik almost causes the plane to crash before calming down.
In a French nightclub, Mystique seduces a Vietnamese army official whom she plans to impersonate to get to Trask.
Back on the plane, Erik says that he was not the one who killed JFK. He claims that he was trying to save him, his reasoning being that JFK was a fellow mutant. Erik apologizes to Charles about how things have played out during the last decade and the two begin to play chess.
Trask enters a conference room full of officials of various governments and tries to convince them of the threat posed by mutants. He is trying to get funding for his sentinel program since the US government has rejected him. During the presentation, he demonstrates how his robots are made without one ounce of metal and goes on to describe how they have the builtin capability of discerning mutants from non mutants. He pulls out a hand-held detector that can sense the Mutant X gene in people; it begins to go off. Mystique's cover has been blown -- she has disguised herself as the Vietnamese officer she seduced -- and she begins to take out many of the men in the room. Enter Logan, Charles, and Erik, who stop Mystique just before she can shoot Trask. Charles tries to explain everything to Mystique and persuade her to drop the gun. She is defiant and Erik strips the gun from her. He then does the unthinkable and aims it at her. She is a threat to all mutants because her DNA can lead to the creation of the sentinels of the future. Erik believes that it is too risky for her to remain alive. Raven pleads with Charles to use his powers to stop Erik, unaware that he is powerless. Meanwhile, upon seeing Stryker who was also at the meeting, Logan begins to lose himself emotionally as he has flashback to the experiments performed on him during the Weapon X Program; he falls into a sort of coma as his connection between future and past is disrupted. His body in the future thrashes and extends its claws, injuring Kitty Pryde, who struggles to reconnect the link through time. Logan comes to in Paris, doesn't recognize anyone or know where he is, and is told by Charles that someone gave him some bad acid. He passes out again.
Hank tackles Erik but fails to stop him from firing the gun. Mystique jumps out the window but Erik is able to guide the bullet to follow her; it hits her in the leg. Outside, crowds of people with cameras capture a wounded Mystique running away. They witness as Magneto levitates outside and drags Mystique to him, the bullet still stuck in her leg. He pulls the bullet from her body, ready to finish her off with it when a transformed Beast attacks him. Onlookers watch in horror as Beast strangles Magneto underwater. Mystique uses this time to escape the area and seek medical treatment. Magneto restrains Beast using some metal ornaments from the fountain and makes an escape as well. Logan regains consciousness -- memories intact this time -- and he and Charles rendezvous with Hank and leave for the mansion to plan their next move.
The media is now in a panic because of the footage of mutants creating mayhem in public. In a tense, crowded Oval Office meeting, Richard Nixon gives Trask the green light to proceed with his sentinel program. Trask says that he can have eight sentinels operational soon. Nixon want to hold a press conference to unveil the sentinels and reassure the American public that he can protect them from the mutant threat.
In a crowded Metro station, Mystique ambushes Magneto, pressing a knife to his throat. He claims that he no longer wants to kill her. He notes that their previous encounter left Mystique's blood on the pavement, which Trask has undoubtedly already obtained. They go their separate ways.
Upon entering the mansion, Charles' legs give way and he falls to the ground and starts hearing people's thoughts. Hank rushes to get him his serum. Charles says that he doesn't take the serum to walk, he takes it to stop the voices he keeps hearing. He is tired of having to feel and hear all of the pain that mutants and humans are experiencing. Logan convinces Charles to not take the serum, exclaiming that he needs the professor to have his powers; it's the only way to find Raven before she can make another attempt to kill Trask. They proceed to use cerebro to try and locate Raven but Charles is overwhelmed by all the noise he has been keeping out for the past 10 years. Logan pleads with Charles to try and read his mind. He does so and sees all of the pain and trauma that Logan has experienced through his lifetime. He sees glimpses of the future and has a telepathic conversation with his future self. His future self reassures Charles that there will always be pain but that it is his gift to use that pain to help others. He shows a younger Charles images of what he will accomplish and how he will use his power to bring hope to others in their most dire times. This is just what Charles needed to bring him focus. He tries locating Mystique again
Back at a Trask facility, a preliminary analysis of Mystique's blood holds promise for Trask who demands that she be captured. They will need to harvest her brain tissue, spinal fluid, and bone marrow. Outside, the Mark I sentinels are loaded aboard a train for their trip to Washington DC; Magneto sneaks aboard the train before it departs. While in motion, Magneto rips the metal from the tracks as they pass over them. He manipulates the metal into small strands which he feeds throughout the metal-less bodies of the sentinels.
At an airport, Charles uses random people as avatars to urge Mystique to stop her mission. Charles is not yet strong enough to mentally stop Mystique as she resists his mental probes. He fails to stop her and he, along with Hank and Logan, depart for Washington DC for the press conference.
Magneto enters a secure facility holding two large ball bearings. He uses the bearings to incapacitate three guards and opens a vault. In the vault we see several artifacts: Havok's X-Men suit, one of Angel's wings, and Magneto's helmet. He is here for the helmet, which he takes.
Cut to the future, where Kitty is losing a lot of blood. Standing guard outside, Warpath spots multiple sentinel ships heading their way. The mutants make their preparations for a final defense; Kitty, Iceman, Professor X, and Wolverine shelter inside while the others guard outside.
Back in the past, Magneto levitates a sports stadium and moves it towards the press event on the White House lawn at which President Nixon will present Trask's sentinels. Hank, Logan, and Charles are there amongst the crowd trying to find Mystique. Nixon addresses the nation and drops the curtains, unveiling the sentinels to the public to much applause. Charles finally spots Mystique impersonating a secret serviceman and freezes her in place before she can pull her gun. Charles has a conversation with her telepathically, trying to persuade her that she was not always so quick to kill and that the Raven that he knew was incapable of doing so. All of a sudden the sentinels roar to life to the shock of Trask and the others. They fire at the police cars and it is apparent that Magneto is controlling them. Trask, Nixon, and other VIPs flee to an underground bunker.
Simultaneously, the battle in the future is erupting as well. Storm uses lightning and wind to crash some of the sentinel transporters. Bishop shoots his rifle through portals created by Blink to take out a few sentinels. Magneto takes the X-Jet and modifies in into an explosive, using Storm to charge it with a bolt of lightning. It explodes sending shrapnel everywhere, decimating much of the sentinel force. Magneto is wounded in the resulting explosion by a piece of shrapnel in his abdomen. The mutants take a sigh of relief, believing the battle to be over. It is not, however, and a sentinel sneaks up behind Storm, stabbing her and throwing her off a cliff as more sentinels flood the mutant stronghold.
In the past, Magneto arrives at the press event and drops the stadium around it. He has created a concrete barrier around the White House to prevent any escape. Charles is pinned by debris in the chaos. Magneto posts seven of the sentinels atop the stadium walls to guard the perimeter and leaves one to engage Wolverine and Beast, ordering the sentinel to do what it was designed to do. The sentinel identifies the two as mutants and attacks. Wolverine is unable to inflict any damage against the sentinel with his bone claws and merely distracts it long enough for Beast to jump on its back and rip out its circuitry. While this is going on we see that Nixon, Trask and company are locked securely in their bunker. Trask's mutant detector begins to go off. Before anything can happen, the room begins to shake; Magneto is ripping the safe room from its foundation.
In the future, the mutants are dying one by one. Colossus is killed by being ripped in half by multiple sentinels. Bishop is bombarded by three of them with energy beams, overcharging him until he explodes. Warpath is killed after a sentinel grabs him, slowly moving the mutant's face into the path of its energy beam. One sentinel forms diamond skin like that of Emma Frost to overcome Sunspot's flames and cuts off one of his arms. He fights back but is flanked by another sentinel who stabs him with claws that resemble Lady Deathstrike's. Magneto, realizing the end is near, uses the last of his strength to apply metal reinforcements to the entrance of the building. Before the sentinels can kill him, Blink transports him inside. As the last line of defense outside, Blink puts up a valiant effort to hold the sentinels at bay but is stabbed by many of them. The sentinels then begin breaking through Magneto's barrier and Iceman leaves to reinforce it with ice.
In the past, Wolverine charges at Magneto. In defense, Magneto hurls debris at Wolverine and stops his assault with a large block of concrete to the back. He then proceeds to force rebar all throughout Wolverine's body, lifting him in the air and throwing him hundred of meters into the Potomac River, where he apparently drowns. Beast is thrown from the back of the sentinel into a wrecked car. Magneto has now fully excavated the metal safe room and ripped off its door. He aims news cameras at himself and addresses the world. He explains that the sentinels were created out of fear for how dangerous mutants could be. He says that they should be scared and proclaims that a new order will be established with mutants in control, threatening to kill everyone in the safe room. Nixon emerges from the safe room, urging Magneto to kill him if he wants but to let the rest of the people go. "Nixon" is actually Mystique in disguise with a gun behind her back. The sentinel targeting Beast rips through the car and is ready to finish him off but Beast is able to inject himself with his serum in time to change back into normal. The sentinel thinks Hank isn't a mutant anymore and proceeds to find new targets, Magneto and Mystique are in its sights. The sentinel charges and Magneto begins tearing the robot limb from limb. Mystique uses this moment an takes a shot at Magneto with the metal-less gun. He is hit non-fatally in the neck causing him to lose focus. She is able to knock him out during his brief moment of weakness and remove his helmet. Charles uses his power to pacify Magneto and it is obvious he has lost. Attention now turns to Mystique who is aiming her gun at Trask saying that he is a monster for the cruel things he has done to her friends. Xavier stops her and makes one final plea to Mystique, saying that he has hope that she will do the right thing. He points out that right now she is a hero in the public eye. He relinquishes control over her, saying that the future is in her hands now.
In the future, the sentinels have breached the room and killed Iceman with energy beams. They confront the last of the survivors and fire killing shots at the group, which includes Xavier, Kitty, and the still unconscious Logan. Just before the shots can reach them, everyone on screen disappears. Mystique has dropped the gun in the past and decided not to kill Trask. Magneto remarks that if he is turned in, they will kill him. Xavier agrees and releases control of him, allowing Magneto to levitate and flee. Newspapers run headlines saying that a mutant saved the president, that the sentinel program was being shut down, and that Trask was being indicted for treason.
Flash to the future where Logan is waking up at the mansion. He hears schoolchildren outside and realizes that the plan worked. He is surprised to see Storm, Iceman, Rogue, and Beast all alive. He encounters Jean Gray. He is awestruck that she is real and doesn't understand why she is alive. Scott Summers appears and is dumbfounded by Logan's happiness at seeing them all. Logan sees Xavier and tells him it worked. Xavier welcomes him back and begins to explain what has happened in the years from 1973 to the future that Logan has missed.
In a voice-over, Xavier explains that events can cause ripples through the river of time and when enough ripples are created, the flow of the river can be changed. Back in the past we see that Logan's body was recovered by military personel. He comes back to life aboard the boat with an army official asking William Stryker what he would like to do with him. Stryker replies that he will take him. As the scene cuts away we see that it is actually Mystique disguised as Stryker.
In a post-credits scene, a skinny bluish mutant, robed and hooded, stands atop a structure. Hundreds of people are bowing to him and chanting his name -- En Sabah Nur -- as he uses his powers to levitate ancient pyramids into place. We see four people on horseback covered in black as the scene fades to black: Apocalypse and his Four Horsemen.