Ling Ling-Fat (Stephen Chow) is one of the Chinese Emperor's four elite personal bodyguards, the "Baolong clan" (保龍一族) - whose names form the Cantonese Chinese New Year's greeting: "Kung hei fat choi" (恭喜發財). Ling Ling-Fat's own name also doubles as a Cantonese wordplay on the code number "008", a reference to James Bond, whose number was 007 (see From Beijing with Love). Instead of studying martial arts like his fellow bodyguards, he devotes his time to making practical yet often mundane and/or cumbersome inventions, such as cannons fired from the mouth, helicopter blades, and magnets. He also practices gynaecology, and spends time with his loving wife (Carina Lau).
In the beginning of the film, Ling Ling-Fat fails to apprehend four ugly swordsmen who are trespassing in the Forbidden City. He does, however, manage to acquire a kung fu manual, Flying Fairy (天外飛仙, Tin1 ngoi6 fei1 sin1, lit. 'Outer Heaven Flying Fairy'), from one of them. During an imperial audience, Ling-ling Fat's seemingly useless inventions and lack of any martial arts skills enrage the Emperor, who demotes him to various menial tasks around the palace.
Meanwhile, King Faceless of the Kam Tribe plans to assassinate the Emperor and overtake China. The Kam Tribe creates a diversion by inviting all the doctors of China to a medical exposition in which a Grey alien - a 'flying fairy' - is to be dissected. Ling Ling-Fat and the Emperor separately depart for the event. While Ling-ling Fat and his wife feast at a string of restaurants, Kam's men kill the Emperor's three remaining bodyguards. The assassins put the unconscious Emperor in an alien costume to present him as the alien for dissection. Just as Ling Ling-Fat and the other doctors discover the Emperor's identity, Kam's assassins begin to slaughter everyone in attendance. Ling Ling-Fat uses his wits and inventions to defeat the assassins.
The Emperor honors Ling Ling-Fat for his success and gives him an enormous pearl as a reward. For his next assignment, the Emperor charges him with investigating a prospective concubine, the beautiful prostitute Kam Cho (Carman Lee). Ling-ling Fat meets with Kam Cho without his wife's knowledge and has difficulty restraining himself from her seductive advances. He gives her the enormous pearl and lies about it to his wife. Later, Kam Cho surprises Ling Ling-Fat at his home, forcing a violent confrontation between Ling-ling Fat and his wife's family. Ling Ling-Fat forsakes his tearful wife and leaves with Kam Cho.
When Ling Ling-Fat brings Kam Cho to the palace, he and the Emperor throw Kam Cho in chains and reveal that she is actually Faceless in disguise. Ling-ling Fat had deciphered Kam Cho's true identity during their meeting and enlisted his entire family in a ruse to fool Faceless. The Emperor begins handing out acting awards to Ling Ling-Fat's various family members, but Faceless manages to break free. Once again, Ling Ling-Fat uses his inventions and wits to combat Faceless, but Faceless fights back with powerful martial arts techniques. On the verge of defeat, Ling-ling Fat is accidentally struck by a lightning bolt meant for Faceless which awakes his potential and enables him to use the Flying Fairy technique, thus destroying Faceless.