Mary Beth, a museum tour guide, takes a school detention group on a secret tour, telling them the story of Mexican town San Angel from the Book of Life, holding every story in the world.
On the Day of the Dead, La Muerte, ruler of the Land of the Remembered; and Xibalba, ruler of the Land of the Forgotten, set a wager for their own worlds after seeing Manolo Sánchez and Joaquín Mondragon competing over María Posada. La Muerte bets on Manolo while Xibalba bets on Joaquín. However, Xibalba cheats by giving Joaquin his Medal of Everlasting Life, granting the wearer invincibility. María frees a herd of captive pigs, getting enrolled in a boarding school in Spain after. Parting ways, Manolo gives her the baby pig from earlier which he named Chuy and she gives him a guitar engraved "Always play from the heart"; Joaquin keeps her bonnet.
Years later, Manolo's dreams are suppressed by his father Carlos, training him to be a bullfighter to honor their family, while Joaquín becomes a hero with the Medal's aid. On Manolo's bullfight, María returns. Manolo defeats the bull but refuses to kill it, dismaying Carlos and the crowd but impressing María. That night, María is pressured by her father and mayor General Ramiro Posada to marry Joaquín for his protection from the bandit Chakal, the previous owner of the Medal, though conflicted. María and Manolo both profess their love before dawn, but are interrupted when Xibalba sends his dual-headed Snake staff to bite her once into a coma. Devastated by María's "death", Manolo is tricked into being bit twice, killing him.
At the Land of the Remembered, Manolo reunites with his mother Carmen and his ancestral family. They travel to La Muerte's castle, discovering Xibalba, now the new ruler of the Land of the Remembered, explaining the bet and that the snake killed him, not María. María awakens, she learns of Manolo's death and accepts Joaquín's proposal. Manolo, Carmen, and his grandfather Luis travel to the Cave of Souls to reach La Muerte, which she is now in the Land of the Forgotten. They meet the Candle Maker, the overseer of mortal lives. After seeing that Manolo's story in the Book of Life is blank and can be rewritten by himself, he takes them to the Land of the Forgotten. Manolo finds La Muerte and exposes the cheat. Furious, La Muerte lectures Xibalba before another negotiation: Manolo's life will be returned if he completes a challenge Xibalba sets him, but he will rule everything and forget Manolo if he fails. Xibalba manifests every Sanchez bull, which merge into a giant bull for Manolo.
In the Land of the Living, Chakal, leads his army to San Angel to find the Medal. Chakal kills Carlos, who joins to watch Manolo fight. Manolo, realizing his fear is actually being himself, refuses to fight and sings an apology, with it peacefully dissolving. Impressed, the deities grant Manolo life and send him and his family to San Angel. Manolo is seemingly killed when Chakal blows himself up, but is protected by the Medal. Joaquín returns it to Xibalba and resolves to be a hero truly, while Manolo and María got married happily as Xibalba and La Muerte reconcile.As the now-amazed children leave the museum, Mary Beth and the security guard reveal themselves as La Muerte and Xibalba, still reconciled peacefully. The Candle Maker then encourages the audience to write their own story.