Tris is shocked by the video released to the public at the end of the Erudite headquarters raid. The video revealed the truth about the faction system and announced that Divergent are needed outside the borders of the city. Factionless leader Evelyn Johnson appoints herself leader of the city. She forces citizens to operate under her command and live as equal and factionless citizens. Tris questions Evelyn's motives and is kidnapped by the Allegiant, a rebel group determined to reinstate their old way of life. The Allegiant invite her to a meeting the following night.
Tris' brother, Caleb, is put on trial for assisting former Erudite leader, Jeanine Matthews. Caleb's betrayal prevents Tris from forgiving her brother. Caleb was found a traitor and sentenced to execution in two weeks. The Allegiant, led by Cara and Johanna, plan to send a group outside the city to find the truth. Tris volunteers to go on the condition that Caleb is taken with them. Tobias, Tris, Christina, Cara, Uriah, Tori, Peter, and Caleb are ambushed after they jump off the train, which results in Tori's death. Driving through the unknown, they meet Zoe and Amar, Four's former instructors, who were believed to have been killed for being Divergent. Zoe and Amar take the group to the Bureau of Genetic Welfare, where they learn the truth about their society. Many years ago, the government believed that society's problems were caused by bad genes. In an attempt to create a better society, they began to fix peoples' genes, with disastrous results. The government set up 'experiments' to repair this mistake, establishing isolated cities across the remains of the United States. The hope was to raise enough genetically pure Divergent individuals to fix the 'genetic damage' left in the wake of the Purity War.
Tris and Four are tested by Matthew and Nita to verify and study their Divergence. Tris is shown to be truly Divergent, but Four's genetic structure indicates that his genes are still 'damaged'. Matthew then brings Tris to the leader of the Bureau, David, to find out the truth about her mother. David gives Tris her mother's journal. Four is secretly asked to join a rebellion led by Nita, who is also genetically damaged. She tells him that the Bureau is lying when they say genetic damage is the cause of society's problems. She intends to demonstrate that the genetically pure are flawed as well. Four tells Tris about the plan, despite Nita's warning to keep it secret. Nita and her allies attack the compound, severely injuring Uriah in one of two explosions. Tris saves David from being shot by Nita and stops the attack. Nita is imprisoned for her crimes.
Tris confronts Four and temporarily ends their relationship. Tris is then offered a position on the Bureau's council and is told of events taking place within the city, including Allegiant's preparations for war with Evelyn and the factionless. David is desperate to stop the violence and maintain his life's work at the expense of destroying the personalities of everyone in the city. He decides to use the memory serum to wipe the memories of people within the city, allowing the experiment to begin with a clean slate. Tris learns the Bureau created the serums that led to the destruction of Abnegation and the enslavement of Dauntless. Repulsed by the Bureau's actions and David's decision, Tris reconciles with Four. With her friends, she begins to create a plan to save her city. The group decides to break into the Weapons Lab and use the memory serum to wipe the Bureau's memories. The Lab is guarded by a fatal dose of the death serum, rendering it a suicide mission. Caleb volunteers for the role, tearfully asking Tris if it will make her forgive him for everything he has done. Tris says yes. Four, Christina, Peter, and Amar plan to go into the city to inoculate their loved ones against the serum.
Christina is able to retrieve doses of the inoculation serum and tells the group to inject themselves with it. Christina gives an extra vial of memory serum to Four, for use against either his father, Marcus, or mother, Evelyn, in hope of bringing an end to the conflict. Four decides to confront Evelyn. Four meets with his mother and gives her the option of drinking it. Evelyn can then end the fighting and become his mother again. She embraces Four without taking the serum. They meet with Johanna and Marcus to iron out an end to the conflict. Peter laments his bad behavior and violent tendencies, which he knows will never change. Peter wants to take the memory serum and become a new person. Four gives Peter the serum and erases his mind.
At the Bureau, Caleb is ready to sacrifice himself, but he and Tris are ambushed by Bureau guards. Tris pulls her gun on Caleb and decides to carry out the mission herself, knowing that Caleb volunteered out of regret for his former actions rather than out of love for her. Tris tells Caleb that if she does not return to tell Four that she did not want to leave him. Tris destroys the entrance to the Lab and is exposed to the death serum, but she survives. David shoots Tris, who lunges for the memory serum and releases it. Tris slowly slips into darkness until she sees her mother reach out for her. She gladly accepts her mother's embrace, succumbs to her wounds, and dies.
Four, Peter and Christina return to the compound and are told about Tris' death by Cara. Caleb gives Four Tris' final message. Four is angered that Tris died for Caleb even after his betrayal. Before walking away, Caleb replies that Tris never wanted to leave him. Zeke and his mother take Uriah off life support. Four cuts his hair and is about to use the memory serum on himself to remove the loss of Tris and Uriah. Christina convinces him to not use it, saying Tris would want him to remember her.
Two and a half years later, Chicago is finally at peace, with former faction members, factionless, compound members, and other outsiders moving in and out at will. Four spreads Tris' ashes while ziplining from the Hancock Building, in memory of her. He accepts all that he has endured and reflects on his belief that while life damages everyone, people can always be mended over time.