Wayne Grey (Seann William Scott), a trainee firefighter practicing in a shack in the desert near Glen Canyon, Arizona, sees a meteor strike his car and land in an underground cavern. College professor Ira Kane (David Duchovny) and his colleague, geology Professor Harry Block (Orlando Jones), investigate, taking a sample of strange blue liquid that oozes from it. Ira discovers that it harbors single-celled nitrogen-based organisms multiplying exponentially, condensing millions of years of evolution within a matter of hours. The next day, they take the science class to survey the meteor site and find it already surrounded by evolved oxygen-converting fungi and alien flatworms. Ira and Harry discover that the cells and organisms reproduce rapidly through mitosis after seeing one of the flatworms they collected in a jar split into two.
Soon, the site is sealed off by the Army, who set up a base. Ira and Harry take General Russell Woodman (Ted Levine) and the clumsy Dr. Allison Reed (Julianne Moore) to court for the right to be part of the research of their discovery, but their efforts fail when it's revealed Ira was discharged from the army after creating an anthrax vaccine that led to terribly debilitating side effects, which the soldiers dubbed "The Kane Madness". Woodman steals Ira and Harry's research, forcing them to infiltrate the base to get another sample; they find an alien rainforest teeming with life. They are caught by Allison as a mosquito-like alien gets inside Harry's body; they are forced to rectally remove the mosquito, which then dies.
Wayne arrives at the college and shows the two the dead body of an amphibian alien which killed a country club owner, much to his delight; they later investigate an animal attack, finding a dead dog-like alien in a woman's home and more dead flatworms. They find a valley behind the home filled with dead flying dinosaur-like aliens; Ira and Harry theorize the aliens are spreading through the caves connected to the main cavern, but can't breathe oxygen. One of the dying creatures spits out a pod containing a newborn, which then hatches into an oxygen-tolerant alien. The alien attacks a mall, where it carries off a shoplifter until Ira, Harry, and Wayne shoot it down.
The positions of carbon and nitrogen relative to arsenic and selenium in the periodic table
is consulted in the story.
Unfortunately, other alien encounters have made the news; this forces the Governor of Arizona (Dan Aykroyd) to demand answers. Allison explains the aliens will engulf the United States in two months. Woodman attempts to blame Ira, when he, Harry and Wayne arrive. However, the governor demands a solution; Woodman suggests evacuating the area and burn the aliens with napalm. At that moment, primate-like aliens attack them, but are fought off. The shaken governor approves Woodman's plan against protests from Ira and Allison that they don't know how the aliens will react. Allison quits the CDC and leaves the site, procuring Ira's original research and samples for him.
At the college, Harry accidentally tosses a match into a petri dish of alien liquid, causing a mass of flesh to rapidly grow from it. Ira realizes heat causes the aliens to evolve, and the meteor crashing to earth activated the alien DNA. Allison attempts to warn Woodman that napalm will only make the aliens stronger, but he ignores her call. Looking at the positions of nitrogen and carbon on the periodic table, Ira theorizes selenium might be poisonous to the aliens, since they are nitrogen-based, as arsenic is poisonous to Earth's carbon life. Much to Ira's surprise, his dumbest students Deke and Danny (Ethan Suplee and Michael Ray Bower) recall selenium sulfide is the active ingredient in Head & Shoulders. This makes Ira award the Donald brothers with an A, much to their excitement. So Wayne procures a firetruck and the team fills it with the shampoo, with help from the Donald Brothers, who tag along with them.
Just as the team arrives at the cave and prepare to fire the shampoo, Woodman's napalm strike causes a similar reaction to the earlier petri dish incident, except on a much larger scale, producing an enormous amoeba-like creature that emerges to the surface. As it prepares to divide, the team drives under the organism, finds what looks like its rectal hole, and Harry (intending to settle a score for the insect incident) pumps a firehose of shampoo into the beast, causing it to explode. Governor Lewis declares Ira, Harry, Wayne and Allison heroes, making Wayne a fully credentialed firefighter while Ira and Allison skip the festivities for romance in the fire truck. Woodman is also demoted to sergeant for his blunder. Later, Harry, Ira and Wayne are shown chasing the flying alien from earlier and promoting Head & Shoulders for both hair care and fighting aliens.