The movie starts out with all of the gods in heaven complaining to the Jade Emperor about the malicious practical jokes played on them by Dragon Fighter Lohan. The Emperor summons Dragon's sworn-brother, Tiger Fighter Lohan (Ng Man Tat), in order to find his location. Dragon eventually appears and "swims" through the crowd to rebuke the gods for their horrible judgments on mankind. He goes on to tell the gods he can do a better job and, right when the Emperor is about to banish him to a reincarnation of an animal, the Bodhisattva Guan Yin (Anita Mui) stays his hand and, instead, issues Dragon a challenge. If he can change the fates of three people—a beggar, a prostitute, and a villain—doomed to nine incarnations as their current position in life within three heavenly days (thirty years), without heavenly powers, he will be upgraded in heavenly status. If he fails, he will be downgraded from an arhat to an animal.
The Bodhisattva gives him a magical fan that can only be used three times a day for sleight-of-hand-like magic tricks to help him in his mission. However, heavenly soldiers force him from paradise before he has the fan in hand. When his future parents visit a Buddhist temple to pray for a child, the religious statue of Dragon Fighter Lohan leaps from a wall containing the major arhats, thus signaling his rebirth on earth. While he grows into manhood (only a few moments in heavenly time), Tiger enlists the aid of a heavenly soldier (Wong Yut Fei) to help him reincarnate on earth so he can bring Dragon the magical fan. However, a mistake by the heavenly soldier causes Tiger to be born to an extremely old woman and the fan to a much younger woman. He then uses his magic breath to cause Tiger to rapidly grows to his proper age, the only problem being it leaves him in the body of a man, but with the brain of a baby. Dragon's earthly parents later adopt the "idiot" and treat him like an infant son.
Dragon eventually regains the memories of his former life after being struck by lightning and soon encounters the beggar (Anthony Wong), the prostitute (Maggie Cheung), and the villain (Kirk Wong). Tiger gains his memories back when clouds block the moon (the time when heavenly security is the most relaxed) and gives Dragon his magic fan before being forced to return to heaven. Dragon uses his magic to influence the thoughts and behaviors of each of his targets. For instance, he turns himself into the likeness of the beggar's father and tells him to stop begging. However, that doesn't work so he turns himself into a host of other beings, including a large pink, marshmallow-like ghost who gets beaten up by the townsfolk. He later uses his magic to save the prostitute from being burnt at the stake. And he transforms himself into Shaolin's patriarch, Damo, to combat the aggressive attacks of the villain. However, unbeknownst to Dragon, the villain is a fervent devotee of a soul-stealing demon who was once an acquaintance of the Shakyamuni Buddha.
When Dragon reaches the three wish limit of his fan (for that day) and the power has been exhausted for the day, the villain murders the beggar and forces Dragon to watch while he brutally rapes the prostitute. The beggar, before dying, regained his dignity and recognised himself by his own name and not as a beggar. A defeated Dragon rushes to the temple that houses the holy golden-skeleton of his body from a former life so he can travel to the underworld to retrieve the beggar's soul. Once there, he confronts the aforementioned demon and trades his golden body for the beggar's soul, but the demon keeps both and kicks Dragon back to the land of the living. Dragon takes the beggar's corpse back to the temple and learns that all of the local gods and arhats housed there are leaving the temple as they do not want to be associated with Dragon, who has made a deal with a demon. The statue of Guan Yin wept when Dragon enters the temple and then subsequently collapse. Dragon waves his magic fan to repair it, only to have it disintegrate into a million pieces (thus symbolizing that all the gods and the Bodhisattva has forsaken him in his time of need).
Thinking he had failed to change the fate of the beggar before his death, Dragon immediately seeks out the prostitute and promises to marry her if she gives up the sex trade. She agrees, but when Dragon begins to transform into a tree because of a prohibition against gods marrying mortals, she thinks he is playing a joke on her and disfigures her face with a hair pin so no one would ever love her.
Meanwhile, the villain slaughters all the prostitutes in his brothel and his henchmen so he could acquire the blood of 49 people and immerse Dragon's Golden Skeleton in it to rid it of its power. Dragon goes to the brothel to confront the villain and, with the help of Tiger and the heavenly soldier, is able to regain his proper form. He then takes out a pair of brass knuckles to beat the villain, only to find he has been given an invincible heart and hence body by the demon. The arhat reaches inside of the villain's chest to show him that the demon has only turned his heart into stone. Feeling betrayed, the villain revealed that the demon has schemed to force all the gods and arhats out of the temple so it can retrieve his scepter of power, which was hidden under the statue of Guan Yin by the Buddha. He then crushes the stone heart in his hand and wishes to be an animal in his next life.
Dragon was given a chance to return to heaven but with a three rank demotion if he admitted defeat. However, he gave up the chance to prevent the demon from retrieving it scepter and brings destruction on Earth. Dragon imbues his power into his golden skeleton and pounds it into powder and made into golden paint. He then use it to write protective talismans on the windows of the temple housing the demon's scepter. However the demon blew away the talisman which forces Dragon and a priest to run away with the scepter as the evil beast demolishes the town looking for it. When the demon tries to squish them under foot, the priest admits that he had stolen two of the skeletons golden teeth to substitute his own. Dragon devises a plan where the priest makes the demon laugh by boasting of his false demon-exorcising powers, while the arhat jumps into the beast's gaping mouth with the golden teeth. This kills Dragon, but ultimately destroys the demon.
The gods begin to celebrate in heaven because Dragon seemingly lost the bet and was going to be demoted to an animal. But Guan Yin interrupts the festivities and shows them how he succeeded in changing the fates of the three people: The beggar is reborn into the house of a rich family, the prostitute opens up a bean curd restaurant and no longer sells her body, and the villain is reborn a pig. Instead of being demoted to become an animal, Dragon was promoted to a senior arhat. The movie ends with a parody of the Miss America Pageant, where Dragon receives a Tiara and a scepter to signify his higher rank.