After the events of Divergent, Beatrice "Tris" Prior, Tobias "Four" Eaton, Caleb Prior, Peter Hayes, and Marcus Eaton seek refuge at the Amity sector. Tris overhears Marcus discussing with the Amity leader Johanna Reyes that the Abnegation leaders died to protect a secret. Erudite and the Dauntless traitors soon arrive to arrest any of the Divergent they can find, though Tris flees with Four, Caleb, and Susan Black towards a train that leads them to the factionless sector. There, they are greeted by Tobias' mother, Evelyn Johnson-Eaton.
She unsuccessfully persuades her son to sway the Dauntless into joining forces with the factionless against Erudite. While Caleb and Susan decide to move back to the Abnegation sector, Tris and Tobias head to the Candor headquarters, where the other Dauntless members now reside. The two are forced to take truth serums, in which Tobias confides his reasons for transferring to Dauntless, while Tris reveals her killing of Will in self-defense, which strains her relationship with her friend, Christina. That night, the Dauntless traitors, led by Eric, arrive and shoot simulation serums on their fellow Dauntless members while at the same throw smoke gas, which knocks all unconscious except for the Divergents — Tris, Uriah Pedrad, and several others. While Eric is executing some of the Divergents, Tris wounds him, giving time for the Dauntless members not breathing the gas, including Tobias, to capture him and force the other traitors to flee. Their safety is revealed to be guaranteed by an Erudite renegade and Will's sister, Cara.
Tris, Tobias, Lynn, and Shauna spy on the discussion set upon by the Candor leader Jack Kang with Jeanine Matthews's representative and a Dauntless traitor, Max. During the meeting, Lynn shoots and kills Max, while Shauna is rendered paraplegic by a nerve serum. To prevent Jeanine from holding another prisoner exchange, Dauntless vote to execute Eric, which Tobias does with no hesitation, while to avoid a dependence on Candor, Dauntless leave for their headquarters and disable most of the security cameras inside. However, Tris is alerted by Christina that one undisarmed camera causes three Dauntless members: Marlene, Hector, and Kee, to become simulated into attempting to commit suicide unless a Divergent is handed over; out of the three, they are unable to save Marlene.
To prevent more people from dying, Tris offers herself over to Erudite and is placed in a cell by Peter and, to her shock, Caleb, both of whom are now working with Jeanine. However, Tobias follows her and ends up becoming captured, although he states that he has managed to convince Dauntless to ally themselves with the factionless, with the upcoming insurgency scheduled several days afterward. After unsuccessful simulation tests, Jeanine orders for Tris' execution, but Peter, in return for Tris' rescue of him at the Amity sector, has swapped the serum for a paralytic serum beforehand and also frees Tobias, allowing the trio a chance to escape back to the Abnegation sector. There, Tris meets with Marcus, who tells him that Jeanine is withholding the information that Abnegation protected; should the factionless take hold of it, it would certainly be destroyed.
Tris, Christina, Marcus head for Amity to request Johanna's help, who, alongside several others including Susan's brother, Robert, choose to assist them despite Amity's resistance. They are additionally assisted by Cara and another Erudite renegade, Fernando, who act as navigators. This so-called "Insurgents" infiltrate the Erudite headquarters the following day, which sees the loss of Fernando, but they manage to access Jeanine's laboratory. Inside, Tris faces simulations before confronting Jeanine, who is cornered by Tori Wu. Despite trying to convince Tori to let her go, Tori kills Jeanine, then brands Tris a traitor. The invasion of Erudite having ended, Tris learns about the casualties, including Lynn, the fact that the factionless have taken all the weapons so they can rule after Jeanine's demise, and is subsequently handcuffed alongside Christina, Marcus, and the other Insurgents, though she is able to tell Tobias about the information, which he and Caleb share through the computers. The information is a video narrated by a woman named Edith Prior, who came from "an organization fighting for peace". Edith vaguely explains that the world had become corrupt, and it is for this reason that the city was sealed away from the rest of the world to allow the Divergent numbers to increase, after which Amity would open the fence forever and the population should re-enter the world. As the book ends, the room erupts into voices.