Plot
Evelyn re-closes Chicago's wall, and puts Jeanine's supporters on trial for plotting a coup. Johanna turns her back on this and is followed by many newly christened Allegiants. Tris and Four free Caleb and escape over the wall with Tori, Christina, and Peter. Edgar leads Factionless guards to catch them, killing Tori.
Edgar catches them in the wastelands, but a group of soldiers with advanced technology rescues the group. They are taken to a city of advanced technology, hidden behind a cloaking shield and serving as the headquarters of the Bureau of Genetic Welfare.
The Bureau's leader, David, explains that society tried to fix human problems through genetic tampering, sparking the Purity Wars that ravaged the planet. The Bureau has been experimenting on people to develop individuals with a naturally pure genome in isolated, ruined cities. Tris is the first genetically pure individual to achieve the desired outcome.
Caleb and Peter monitor Chicago remotely, while Christina and Four train with Nita. Matthew brings Tris to David, the Bureau leader, who gives her a device to view her mother's memories. She learns her mother was rescued as a child and volunteered for the Chicago experiment. Caleb warns Four and Tris about the conflict between Allegiants and Factionless. Tris agrees to help David with the experiment if he asks the council to intervene.
During a military rescue mission to a wasteland village, Four realizes that the Bureau is kidnapping children and wiping their memories. He attempts to warn Tris of the Bureau's intentions, but David interrupts them. Four urges Tris to return with him to end the bloodshed, but she decides to go with David, who agrees to return Four to Chicago with Matthew and some Bureau soldiers.
On the way, Matthew warns Four that David ordered his death. Four kills the soldiers, but the transport crashes. Matthew gives him a device to pass through the cloaking shield as he returns to the Bureau and warns Tris. Disagreeing with the council, Tris states that the pure-versus-damaged divide is no better than the Chicago Factions. She criticizes them for not stopping the violence. The council reveals that David has full authority over Chicago and intends to reinforce the Factions.
Tris ends her partnership with David and gathers Caleb and Christina in his hovercar to return to Chicago. Nita helps them escape, revealing David's unpopularity with the Bureau. The Factionless capture Four, who confronts Evelyn about the violence. Tris, Caleb, and Christina arrive to find the city in chaos during an Allegiant assault. At the Bureau, David makes a deal with Peter to promote him and gain access to Chicago, convincing Evelyn to use a hidden stockpile of amnesia gas to erase all factions' memories and create peace. She agrees, and Peter takes her to the vault.
Four, Tris and Christina fight through the Factionless and arrive at the vault. Four convinces Evelyn to stop the gas attack, as he would not remember her. She capitulates, but a frustrated Peter shoots her in the leg, gloating until the same gas starts flooding the vault. Realizing David has betrayed him, Peter opens the vault so Tris and Four can stop the gas. Peter flees back towards the Bureau, though Four vows to find and kill him.
Caleb arrives and helps Tris destroy the gas dispersion hub. The group gathers atop the Erudite building as it watches David's hovercar autopilot back towards the Bureau. Tris transmits a message to the world, revealing the Bureau's existence and that Chicago was an experiment in genetic purity. Her message tells the Bureau that Chicago is no longer their experiment. Caleb then detonates the explosives they loaded into the hovercar, disrupting the cloaking shield and revealing the Bureau to the world.