Long ago, Lord Shen (Gary Oldman), heir of the peacock clan that ruled Gongmen City in China, sought to harness the power of fireworks as a weapon with which to rule the entire country. When he learned from the court's goat soothsayer (Michelle Yeoh) that "a warrior of black and white" would one day defeat him, Shen assumed she was referring to the giant pandas and had them exterminated to avert the prophecy. Shen's parents were horrified at this atrocity and exiled Shen, who swore revenge.
Afterward, Shifu receives word that Master Thundering Rhino (Victor Garber), leader of the kung fu council protecting Gongmen City, has been killed by Lord Shen with his newly developed weapon, a cannon, which threatens to destroy kung fu tradition. Po and the Five go to stop him, reaching Gongmen City to find it under the control of Shen's forces. The heroes find two imprisoned council members, Masters Storming Ox (Dennis Haysbert) and Croc (Jean-Claude Van Damme), and ask their help to liberate the city, but both masters cite their helplessness against Shen's weapon and refuse to escape. Po and the Five are then discovered by the wolf leader, who they chase to prevent him from alerting Shen, only to be captured.
Upon being brought before Shen in his tower, Po and the Five free themselves and destroy Shen's cannon. However, Crane burns his wing and Po is again distracted by a flashback upon seeing the same symbol as before on Shen's plumage, allowing Shen to escape and destroy the tower with an arsenal of cannons. After escaping, Tigress (Angelina Jolie) confronts Po over his distraction. Po explains that he remembers Shen's presence on the night he was separated from his parents, and wants to question Shen about his past. Though empathetic, Tigress orders him to stay behind for his own safety. Po regardless breaks into Shen's cannon factory to confront Shen, inadvertently foiling the Five's attempts to destroy the factory. Shen claims that Po's parents abandoned him before he blasts Po out of the factory and captures the Five.
Po is rescued by Shen's soothsayer, who has been exiled by Shen to the ruined village where Po was born. Guided by the soothsayer to embrace his past, Po remembers that his parents had endangered themselves to save him from Shen's forces, his mother hiding him in a crate before she was subdued. Attaining inner peace, Po returns to Gongmen City to save the captive Five from being executed by Shen at the city harbor, as well as to prevent Shen's army to enter the open waters to begin his conquest of China. During the ensuing battle (in which Shifu participates after having persuaded Ox and Croc to do the same), Po uses his inner peace to enable a kung fu technique to redirect Shen's cannon fire against his own armada and destroy it. He then urges Shen to let go of his own past, but Shen refuses and attacks Po until Shen inadvertently slashes the ropes holding up his last cannon, which falls and crushes him to death. Victorious, Po returns to the Valley of Peace and reunites with Mr. Ping, declaring him to be his father. Moments later, we see Po's biological father (Fred Tatasciore) in a far-off hidden village inhabited by surviving pandas, sensing that his son is alive.