Once upon a time, the Trolls all lived in a tree, and they were the happiest creatures ever. They would sing, dance, and hug all the time. However, they were discovered by the Bergens, who were miserable and could only be happy whenever they ate a Troll. The Bergens gathered once a year for an event called "Trollstice", where they would eat Trolls and be happy for one day.
Young Prince Gristle (voice of Christopher Mintz-Plasse) wakes up his father, the King (voice of John Cleese), on the day of Trollstice. All the Bergens gather around the Troll tree as Chef (voice of Christine Baranski) gets ready to cook up some Trolls. Since it is Gristle's first time ever eating a Troll, Chef prepares to hand over the happiest Troll, Princess Poppy (voice of Iris Dohrn). When she picks from the tree, Chef finds that all the Trolls have been replaced with wooden dolls with crazy hair. The Trolls have escaped underground to a new home, while the King banishes Chef from Bergen Town. She angrily vows to find the Trolls and have them eaten, while the King tells his son that nothing will ever make him happy.
20 years later, the Trolls live in the forest, with Poppy (now played by Anna Kendrick) leading them all in a song. Her dad Peppy (voice of Jeffrey Tambor) is king, and her Troll friends include Biggie (voice of James Corden), a big Troll with a worm friend named Mr. Dinkles; Guy Diamond (voice of Kunal Nayyar), who has an autotuned voice and can fart glitter; Cooper (voice of Ron Funches), a giraffe-like Troll; Satin and Chenille (voices of Aino Jawo and Caroline Hjelt), the fashionistas; DJ Suki (voice of Gwen Stefani); and Creek (voice of Russell Brand), a zen-like Troll. Poppy is throwing a party that day in honor of their arrival to this home. The only Troll that is never happy is Branch (voice of Justin Timberlake), who is grey and constantly pessimistic. He lives in a bunker to protect himself from the Bergens, and he refuses Poppy's invitation to the party.
The Trolls have their party, but the bursts of glitter and light and the sound of loud music is enough to get the attention of Chef, who now looks ragged and disheveled, having spent the last 2 decades searching for the Trolls. She goes stomping down into the forest and starts grabbing Trolls. She grabs Biggie, Creek, Cooper, Suki, Satin, Chenille, and a tiny troll named Smidge (Walt Dohrn). The other Trolls hide in the forest by blending in.
Poppy goes to Branch's bunker and asks for his help, but he refuses. Poppy then brings back the rest of the Trolls into the bunker, to Branch's displeasure, as she sets off to find her friends by herself.
Poppy sings an upbeat song about not letting anything get her down, until she is caught in a spider web. Four spiders approach her, but they are scared off by Branch as he whips his hair at them to hold them back, causing them to walk into the mouth of a bigger creature. Branch decides to join Poppy in her quest, albeit with reluctance.
Poppy and Branch rest for the night. Poppy starts to sing and say goodnight to pictures of all her captured friends, which bugs Branch. Poppy gets out her ukulele and starts singing "The Sounds of Silence", with other forest creatures joining in. Branch asks Poppy for the ukulele and he just tosses it into the fire.
The two come across a tunnel that's supposed to lead them to Bergen Town. They meet Cloud Guy (also Walt Dohrn), who offers to show them which path leads to Bergen Town, and which one leads to DEATH. Branch gets annoyed with Cloud Guy when he tries to do a high-five, so he breaks a stick and chases him through the tunnel with Poppy running after them. Poppy and Branch wind up in Bergen Town and see how gloomy all the Bergens are in their everyday lives.
Poppy and Branch find their friends in the castle as they follow the light from the Trolls' wristbands that signal the hugging hour. Chef brings the captured Trolls to Gristle, who is now king of the Bergens. She wants to bring Trollstice back, and she offers up Creek as the first Troll that Gristle will eat. He is hesitant at first until Chef shoves Creek into Gristle's mouth, leading the other Trolls to think he's been eaten. Chef hands over the rest of the Trolls to Bridget (voice of Zooey Deschanel), a scullery maid, to keep them until it is time for Trollstice.
The Trolls find out that Bridget is in love with Gristle, as she sings Lionel Richie's "Hello" while thinking of him. They speak to Bridget and offer to help her out in return for not letting them get eaten. The Trolls start singing, but Bridget asks why Branch isn't singing. He refuses to do so until Poppy asks him why he won't sing. Branch admits that he thinks his singing was what got his grandmother eaten. As a child, he sang beautifully until Chef almost grabbed him, but his grandmother jumped in to save him, leading to her capture. That moment took away his happiness and color. With Poppy's encouragement, Branch decides to help Bridget.
They give Bridget a makeover and sit on her head to give her a full head of colorful hair under the guise of Lady Glitter Sparkles. She manages to get Gristle's attention and joins him on a date at a pizza place/skating rink. Bridget is awkward and nervous at first, but with some help from Branch, she starts to gain the confidence to say how she really feels about Gristle, allowing him to fall in love with her. The Trolls then see that Gristle is carrying Creek inside a jewel. Their date is interrupted by Chef, who nearly catches Bridget. She flees and leaves behind a rollerskate, which Gristle keeps.
The Trolls steal Gristle's jewel and open it to rescue Creek, but when they open it, he's not inside. Chef recaptures them all and reveals that she is being helped by Creek. He admits that he sold the Trolls out in order to save his own skin. He steals Poppy's cowbell and leads Chef and some other Bergens to the forest where they take the rest of the Trolls.
Chef stows all the Trolls inside a giant pot. Feeling betrayed and hopeless, Poppy becomes sad and loses her color, and the rest of the Trolls follow suit. After some silence, Branch starts to sing "True Colors". His voice and newfound optimism inspires his friends, and they, along with Branch himself, regain their color and happiness. Bridget overhears the Trolls and allows them to escape since she is thankful for their help and for showing her how to be happy. She tells Poppy she loves her for helping her and lets them go free. However, Poppy can't bring herself to abandon Bridget, and she rallies her friends to show the Bergens that they can be happy too.
The Bergens are gathered for the feast, but Gristle wants to wait for his date. Chef makes them start without her, but she opens the pot and finds that the Trolls are gone. Thinking Bridget ate them all, Chef orders the guards to seize Bridget, until the Trolls crash in on Bridget's skate. They land on her head to show Gristle she was his date. Poppy tells Gristle that he managed to be happy without eating a Troll by being with Bridget, leading the other Bergens to realize that they can be happy on their own too. Poppy and Branch start to sing "Can't Stop The Feeling", turning the feast into a big dance party. Chef tries to get the Trolls herself, but Bridget throws a wooden spoon at her head, causing her to stumble onto a cart that rolls out of the castle, sending Chef and Creek away from the kingdom.
Poppy is crowned queen of the Trolls as both Trolls and Bergens now live in harmony. She and Branch stand atop a tree and share a hug, along with Cloud Guy.
After the initial credits, Chef and Creek's cart stops rolling. Chef prepares to eat Creek herself, but they soon find out they are on top of a monster, who opens his mouth and eats them.