Tris Prior is a 16-year-old girl living in a futuristic dystopian Chicago where all the people in the city have split into five factions: Amity, Erudite, Dauntless, Candor and Abnegation. Each is dedicated to the pursuit of one particular virtue: Amity prizes peacefulness; Erudite prizes knowledge; Dauntless prizes bravery; Candor prizes truthfulness; and Abnegation prizes selflessness.
As the novel begins, Tris is having dreams of Will, the Dauntless boy she killed during the conflict at the end of the previous book, Divergent. When Tris wakes up, she, her boyfriend, Tobias, their acquaintance Peter (all from the Dauntless faction), Tris' brother, Caleb, from the Erudite faction, and Tobias' father, Marcus, from the Abnegation faction, are on a train that arrives at the Amity compound, where they are seeking refuge from the Erudite.
In addition to Tris and her group, many refugees from Abnegation have come to the Amity compound. Amity members agree to let their headquarters be a safehouse for members of all factions, under the following conditions: No weapons are allowed in the Amity compound, no verbal or physical fights are permitted, and no discussions of the conflict between the factions are allowed. Tris and Tobias are certain that they will not be able to stay long in the Amity compound because, as members of Dauntless, they are not good at avoiding confrontation. Tris also realizes she is already breaking the Amity rules because she is hiding a gun under her mattress, after Tobias encouraged her to keep at least one weapon hidden when they entered the compound.
That evening, Tris follows Johanna Reyes, the leader of Amity, as she goes for a walk with Tobias' father, Marcus, a leader of Abnegation. Johanna is trying to figure out why Jeanine Matthews, the Erudite leader, began an attack on the Abnegation. Marcus refuses to tell Johanna about Jeanine's motivation. He does say that the Abnegation know some sensitive information and that Jeanine was attacking them because of this information. Tris wonders what sort of information could have prompted the Erudite to attack and kill members of the Abnegation. Tobias believes that his father is exaggerating the importance of the information in order to seem more powerful than he really is. Tobias suggests that he and Tris return to the inner city of Chicago and find a way to bring down the Erudite faction.
Tris and her brother, Caleb, have a conversation in which she explains to him why, although she chose to become a member of the Dauntless faction, she is actually a rare personality anomaly called a Divergent. When Tris went through the faction-placement computer simulation that all teenagers take, the simulation decided that she showed Erudite, Abnegation and Dauntless characteristics. Tris' test administrator, Tori, warned Tris not to let anyone know that she was truly Divergent because her life might be in danger. Tris' Divergent status also makes her react strangely to any computer simulations she is put into; while most people in a brain-simulation scenario are unaware that they are seeing an altered reality, Tris always knows that she is in a simulation and can sometimes alter the simulation. Tris was immune to the dangerous computer simulation used by the Erudite to turn the Dauntless faction into mindless soldiers, which is why she was able to rescue Tobias when he was mind-controlled.
Marcus suggests to Tris that she and Tobias escort the refugee Abnegation members, himself included, back to the city. Tris meets Marcus privately and asks him about the conversation she overheard between him and Johanna. Tris mentions that her father died back in Chicago, and Marcus confirms that Tris' father died to protect the special information that the Abnegation have been guarding.
Tris continues to have nightmares about killing Will, but she is afraid to tell Tobias or anyone else about what she has done.
The Erudite arrive at the Amity compound, guarded by an escort of armed enemy-Dauntless. Tris, Tobias and all the refugee Abnegation members have to disguise themselves in order to blend in with the Amity, but Tobias is quickly discovered by an enemy-Dauntless guard. A fight breaks out, and shots are fired. Tris is unable to fire her own gun because of her traumatic memory of shooting Will, but Caleb commandeers her gun and protects her from the attacking Dauntless.
In the confusion of the fight, Tobias, Tris and the Abnegation members split up and flee the Amity compound. They escape through the cornfields, fleeing to the city of Chicago. Tris, Tobias and Caleb jump onto a train entering the city and find themselves among the factionless, homeless people who failed to pass the initiation rites for any of the five factions. They are led to a warehouse where the factionless live together. In the warehouse, they meet Tobias' mother, Evelyn, who has long been presumed dead. Evelyn is the leader of the factionless, and she has been keeping track of the Erudite's movements. She invites Tobias to stay and help her lead the factionless, but he is not certain that he wants to join his mother, who abandoned him to his abusive father. Former Dauntless initiate Edward informs them that half the Dauntless faction has joined the villainous Erudite, while the other half is staying with the Candor faction. Almost all of the Abnegation are living with the factionless, outside of their compounds.
Evelyn has been keeping track of the Divergent members of the factionless. Unlike Tris, most Divergent people are unable to join a faction because they cannot embrace only one way of behaving and only one way of viewing the world. Since Divergent people cannot be mind-controlled by the faction-specific simulations of the Erudite, they will be especially valuable soldiers. The factionless are trying to overthrow the Erudite so they can establish a new society without factions. Caleb goes to stay with the displaced members of the Abnegation, while Tris and Tobias go to Candor headquarters to see if they can learn more about the current conflict.
At the Candor headquarters, Tris and Tobias are placed under arrest for unknown reasons. Then they are injected with truth serum so the Candor can learn whether they helped carry out the Erudite's attack on the Abnegation. The truth serum proves Tris' and Tobias' innocence, but under the influence of the serum, Tris also admits to killing Will during the attack.
Tris hangs out with other ally-Dauntless members who are staying at the Candor compound. Suddenly, some enemy-Dauntless soldiers who are working for the Erudite arrive with a new type of gun and begin shooting. Tris is shot with a blue laser beam, which knocks her to the ground. The enemy-Dauntless throw smoke bombs into the room, and Tris notices that all the ally-Dauntless around her have passed out. Tris is unaffected by the smoke, but pretends to be unconscious as the enemy-Dauntless walk in to survey the damage. She waits until no one is looking before putting on the uniform of a fallen enemy-Dauntless.
Tris' Dauntless friend Uriah is also immune to the simulation smoke, which seems to knock out only people who belong purely to one faction. Tris and Uriah begin to search the Candor headquarters for other Divergent people who have not been knocked out by the simulation smoke. It turns out that the enemy-Dauntless are also looking for Divergent people, and they set off the smoke bombs intentionally to find them. Tris gets into a fight with Eric, the cruel leader of the enemy-Dauntless. Eric captures her and places her under guard with several other Divergent. Eric begins to execute the Divergent, but Tris manages to stab him in the chest with a knife she had hidden in her back pocket. After Tris stabs Eric, the enemy-Dauntless scatter and the ally-Dauntless begin to awaken and fight back. Tobias arrives to protect Tris during the fight because, after stabbing Eric, she is in shock and unable to use a gun to defend herself.
Tris learns that Eric isn't dead, and she and Uriah discuss why Jeanine Matthews might be trying to root out the Divergent. They think she wants control of all five factions, and in order to rule them completely, she needs to eliminate all free-thinkers like the Divergent. Tris also concludes that Jeanine has developed a new longer-lasting simulation serum to keep the population under mind-control for an unknown length of time, instead of just a few minutes.
Later that evening, the Candor leader, Jack Kang, says he believes that the enemy-Dauntless and the Erudite are actually on a diplomatic mission, since they killed so few people during their attack. Kang wants to negotiate with Jeanine Matthews, but the ally-Dauntless disagree with his plan.
When people begin to taunt Tobias for admitting that he was once terrified of his father, Marcus, Tobias picks a fight with his father. Tobias punches him and beats him with a belt, as Marcus used to do to Tobias when he was a child. Tris stops Tobias from doing any further damage to Marcus. Tris realizes that the beating was a calculated act on Tobias' part to make the ally-Dauntless respect him because he is seeking a position as their leader. As the Dauntless leader, Tobias hopes to unite with the factionless to overthrow the Erudite.
Tris, Tobias and four other ally-Dauntless eavesdrop on Jack Kang's negotiation with Jeanine Matthews. Jeanine does not show up at the negotiation, but Max, a leader of the enemy-Dauntless, does. Max tells Jack that Candor is a disposable faction and that Jack should follow Max's orders. From Max's strange speech patterns, Tris deduces that Jeanine herself is giving him the words to say by communicating through an earpiece, which means she must be nearby. Tris' friend Lynn shoots Max in the chest, and in the resulting confusion, Tris begins to look for Jeanine. She discovers that Peter has become an enemy-Dauntless and is guarding Jeanine, but she has to let Peter go because one of her friends is injured.
Tris, Tobias and their friends return to the Candor compound, but Tobias has grown increasingly concerned that Tris is trying to get herself killed because she rushes into needlessly reckless situations. Tris argues that she is trying to be protective and sacrificial like her parents were, but Tobias says that her parents sacrificed out of necessity while Tris keeps entering life-threatening situations even when no one needs her to do so.
The ally-Dauntless decide to return to the Dauntless compound and take it back from the Erudite. Tobias is elected as one of the ally-Dauntless' new leaders, and one of his first duties is executing the enemy-Dauntless leader Eric. The ally-Dauntless return to their headquarters. Tris and Tobias go to meet with Evelyn and Edward, leaders of the factionless. They agree to join forces to bring down the Erudite, though Tris feels conflicted about destroying an entire faction.
That night, Tris wakes to find that three of the ally-Dauntless have been put under a mind-control simulation. The mind-controlled people are standing at the edge of a rooftop as if they are about to jump off. Jeanine Matthews uses the voice of one girl to say that a few mind-controlled ally-Dauntless will kill themselves every two days until one of the Divergent delivers themselves to Erudite headquarters. Tris and her friend Christina manage to save two of the ally-Dauntless from jumping, but the third leaps to her death.
Tris decides that she will give herself up to the Erudite in order to spare the Dauntless any more deaths. Tobias is furious at Tris for wanting to give up her life, and she lies and tells him that she does not intend to leave. Tris sneaks out and goes to the Erudite headquarters where Peter becomes her main guard. Jeanine says that they are going to study Tris' brain so they can make a simulation that properly mind-controls the Divergent. After the Erudite have finished studying Tris' brain, she will be executed. Tris is resigned to her own death, but she is angry when Tobias arrives at the Erudite headquarters, saying he wants to die as well.
Tris is put through several mind-control simulations. She is tortured with a terror-simulator so that Tobias will tell Jeanine the locations of the factionless safe houses. Jeanine also reveals to Tris that her own brother, Caleb, is the one who gave the Erudite most of the information about Tris. Tobias fights his guard and briefly escapes with Tris, but he does not try to leave the compound. He and Tris search through the Erudite headquarters to find the control room. Tobias then tells Tris that he did not come on a suicide mission, after all. He was sent to find the Erudite's control room so that the attacking ally-Dauntless could destroy Jeanine's simulation data. He also came to encourage Tris to hold onto her hopes because she will be rescued within two weeks.
After Tris is re-captured, Jeanine tells Tris that she is trying to mind-control everyone in Chicago because there is a threat from outside the city. Tris gets free of her guard, Peter, and scratches Jeanine's face until it bleeds. Jeanine looks at Tris with anger and hatred, which pleases Tris because she feels like she has defeated her robotic enemy by making Jeanine feel negative emotions. Peter tells Tris that her execution has been ordered for the next day.
In the morning, Tris is escorted to her execution room. Jeanine injects Tris with a serum that is supposed to kill her. However, although Tris' heartbeat no longer registers on the monitor and she loses the ability to move, she is still aware of her environment and can hear what is going on around her. Peter wheels Tris' inert body to a room where Tobias waits, and Peter offers to carry Tris while all three of them escape. Peter has arranged for them to get away from the Erudite headquarters by sliding out of the deactivated trash incinerator.
Tobias takes Tris and Peter to the Abnegation sector. Tobias brings Tris to stay in his parents' old house. When they arrive, Tobias promises to be Tris' family now that her parents are dead and her brother is a traitor. The next day, Tris enjoys spending time with the factionless, people who are not trying to define themselves by the pursuit of one behavioral trait. In the Abnegation sector, Tris meets with Marcus, who finally tells her that Jeanine attacked the Abnegation because they were about to publically reveal some information about the world outside of the city. Marcus worries that if the factionless are allowed to completely destroy the Erudite, they may also destroy this important information about the outside world.
The factionless and ally-Dauntless prepare to attack the Erudite. Tris decides to secretly take her friend Christina and help Marcus. Tris and Christina dress like Amity girls so Marcus can smuggle them into the Amity compound. There, they tell Johanna Reyes about the ally-Dauntless and the factionless attacking the Erudite. Johanna and a few of the Amity decide to head toward the battle in order to be peacekeepers, while the other Amity stay behind.
Tris, Marcus, some Amity and some ally-Erudite leave to attack the Erudite headquarters. Tris' brother, Caleb, an enemy-Erudite, threatens her with a gun, but Marcus knocks Caleb unconscious. Tris discovers that the important data about the outside world is actually on Jeanine's personal computer. Tris and Marcus search for it.
Tris enters a room in the Erudite building, and the room produces a simulation scenario. Tris is told that she must reach the blue door within five minutes or she will be poisoned with gas. Tris has to fight a simulation of her own self, which means that she has to find a way to outthink herself. Tris can mentally manipulate simulations, so she imagines a gun for herself to use. Tris has not been able to wield a gun since she shot Will, and now her simulated double transforms into an image of Will. Tris manages to shoot the simulated Will in order to get to the blue door before the poison kills her. Tris finds Jeanine on the other side of the door, but before she can get Jeanine to retrieve the information from her personal computer, an ally-Dauntless leader named Tori kills Jeanine by stabbing her in the stomach.
Now that the Erudite have been overrun, Evelyn announces that all factions will be disbanded since the faction system is flawed. The factionless surround the remaining ally-Dauntless in the Erudite headquarters lobby, dissolving their alliance and capturing them. Tobias enters the Erudite lobby and tells Tris that he persuaded Caleb to find Jeanine's hidden information. The screens in the Erudite lobby begin to broadcast the secret Jeanine wanted to keep hidden.
In the video, a woman named Amanda Ritter explains that she is part of an organization dedicated to justice and peace. She explains that humankind has become so senselessly violent and cruel now that there is no single enemy to fight — the battle is essentially against human nature itself. Amanda says that in order to keep the citizens of Chicago safe, her organization made sure that the factions had their own water and power supply. The organization also set up the faction system, in hopes that the citizens of Chicago would regain the morality that the outer world had lost. Amanda says that over time, more citizens with flexible minds will be born — the Divergent. When enough Divergent exist, the Amity are supposed to unlock the gate to the outer world so that the citizens of the factions may emerge and help the outer world. Amanda says that she, among others, is volunteering to have her memories wiped and replaced so she can become a part of the faction experiment. Amanda says that her new name will be Edith Prior, and the video ends.