During the reign of King Zhou (Tony Leung Ka-fai), an official enters his bedchamber, and is devoured by the monstrous tails of Daji (Fan Bingbing), his concubine. Outside their city, several warriors within a metal wagon discuss their strategies to free the Invisible People and their Chief, when Jiang Ziya (Jet Li) appears to them. He tells them that when King Zhou was younger, he let himself become possessed by the Black Dragon for his quest for power. Jiang Ziya later departs riding his crane.
Within the city, King Zhou and Daji hold a festival, and torture the chief of the Invisible People to foretell his future. The chief shows King Zhou a vision of himself pleading for mercy and disintegrating away, causing the King to order his guards to remove the chief's eyes. At the same time, the warriors sneak into a prison and fight several guards, where Leizhenzi (Jacky Heung), a member of the Wing Adept tribe, uses his powers to destroy the metal bars that seal the Invisible People, even though he was warned not to use them there. His powers attracts Shen Gong Bao's (Louis Koo) attention, and he rides on his black leopard to pursue them. Several of the Invisible People are then killed by more guards. Nonetheless, the warriors manage to escape with the Invisible Children, who use their powers to teleport to another location. To stop Shen Gong Bao from advancing any further, Leizhenzi destroys a wall and creates a barrier. As Leizhenzi and Ji Fa (Andy On) talk, he explains about his past in which his father was killed by an invading army that exterminated most of the Wing Adepts, and his father's wings were torn off his back.
Jiang Ziya arrives to interrupt the festival and stops time, allowing him to free the Invisible chief, and help the warriors and the Invisible Children to escape. As Jiang Ziya avoids Daji's tails, she casts a magic spell at him. To save him, the chief digs out one eye and throws it towards Daji to distract her, but he gets destroyed by her tails instead. Jiang Ziya escapes to his crane with one of the chief's eyes, while the other eye is obtained by Daji.
The warriors return to their capital. Leizhenzi tries to grow wings where King Ji Chang (Zu Feng) requests Jiang Ziya to use the chief's eye to find a way to defeat King Zhou and the Black Dragon. Jiang Ziya answers that it is by using a sword known as the "Sword of Light", which can only be used by the chosen hero "Golden Dragon", and that they must find the sword before the three suns converge, in which the Black Dragon will be released. But while doing so, Jiang Ziya becomes younger, as he warned that Daji cast a spell on him that reverses his age, and for each time he uses his magic the reverse-aging accelerates.
Leizhenzi volunteers to find the sword, and Jiang Ziya tells him that he must take three gifts from the Spring of Life with him. He also summons an egg from the well, out of which Ne Zha hatches and causes mischief. Leizhenzi and Ne Zha depart into a wasteland, where the first of Jiang Ziya's gifts, a one-eyed plant, gives Leizhenzi advice. Ne Zha plays with the plant, and the three are chased by an legendary desert centipede-like worm, which Leizhenzi kills. Ne Zha steals from Leizhenzi the second gift: a baby Dragon Prince whose growth was stunted by Ne Zha, and it subdues the quickly-grown Ne Zha (Wen Zhang) by breathing a gas on him, making him unconscious while turning him into an adult. Upon waking, Leizhenzi forces him to help him find the Sword of Light, while promising to him that he will help Ne Zha find his Fire Wheels.
Shen Gong Bao constructs and animates an automaton (Angelababy), and instructs her to find and kill Leizhenzi. Leizhenzi and Ne Zha stumble into a collection of pillars within a marsh, which turn into a palace in a desert, where a hermit (Huang Xiaoming) manipulates sand with magic. Irritated, the hermit attacks them, but is defeated. The hermit is revealed to be Erlang Shen. Leizhenji gives Erlang Shen the third of Jiang Ziya's gifts: his faithful dog Howling Celestial. Erlang Shen then leaves them to find his Golden Armor.
Leizhenzi and Ne Zha travel to a port, where the former encounters a beautiful woman who entertains children with glowing butterflies, whose name is Lan Die, in reality the automaton. Leizhenzi and Lan Die go find a sorceress Taiyi Zhenren, who uses his dreams to read into his mind. After being woken by the plant, Lan Die steals the artifact that they use as a ship to sail out of the port, and Ne Zha follows. That ship is supposed to sail to any location that its user desires. While in the ship, Ne Zha torments the baby Dragon Prince, who breathes gas on Ne Zha again to put him to sleep and reverting him back to a child. Lan Die and Leizhenzi admire the sunrise, but Shen Gong Bao takes her memories away, revealing her to be an automaton.
Leizhenzi wonders why is the ship going to the middle of the ocean, and the plant answers that it is because someone else, the baby dragon prince, has controlled the ship to return to his father's palace. As the Dragon Prince sings, the Dragon King of the East Sea (Waise Lee) hears him and orders his giant octopus to bring Ne Zha and his son back to him. While in the sea palace, Ne Zha demands the Dragon King to return his Fire Wheels to him. The Dragon King orders his guards to attack Ne Zha, but he defeats them by urinating and passing gas at them. The Dragon King gives Ne Zha the Fire Wheels, and is given the baby dragon prince in exchange. With the fire wheels, Ne Zha turns into an adult and flies away.
The ship is now able to fly to Leizhenzi's former home, which is now in ruins. He finds the Sword of Light, which is guarded by several rapidly-moving rings that surround its floating island. Shen Gong Bao arrives with a fleet of flying ships, and subdues Leizhenzi. In exchange for Leizhenzi's life, Lan Die overcomes the rapid rings, and retrieves the sword, but it inadvertently destroys the rings and blows Shen Gong Bao and his fleet away. Leizhenzi grows new wings and carries the dying Lan Die to see the sunset. She turns into a wooden mannequin, and he leaves her to rest at the sword's island, taking the sword with him. As he notices the suns beginning to converge, he hurries with Ne Zha and Erlang Shen (who has found his golden armor) back to the capital, which is now under siege by another fleet of King Zhou's flying ships. As Jiang Jiya struggles to use the city's defense system properly, Daji uses her magic again to revive Shen Gong Bao, which turns him into an invincible monster.
The three heroes return with the Sword of Light to find Jiang Ziya being reverted to a young boy. They fight Shen Gong Bao, who during the fight kills Ji Chang. With his dying breath, Ji Chang passes his command and the sword to his son, Ji Fa. Ji Fa rushes to the Spring of Life and dives in to charge the sword. As the heroes draw Shen Gong Bao into the Spring of Life, Ji Fa emerges as the "Golden Dragon" with his charged sword and new golden armor, and kills the monster.
The movie ends with Ji Fa mobilizing his forces for a counter attack and flies his fortress towards the Shang kingdom, while King Zhou turns into the Black Dragon awaiting for the heroes to attack, with a baby Jiang Ziya in their possession.