In the distant future, several hundred years after a revolution by Galactic War Veterans overthrew the world's governments and imposed a militaristic regime titled 'The Global Federation of Earth', humanity is at tense diplomatic relations with an alien race whose homeworld is the planet Klendathu (one of many planets inhabited by these creatures located on the other side of the Milky Way Galaxy) who are named the Arachnids, or 'Bugs'. John 'Johnny' D. Rico (Casper Van Dien), his girlfriend Carmen (Denise Richards), and best friend Carl (Neil Patrick Harris), who possesses psychic abilities, graduate from high school in Buenos Aires. Carmen and Carl enlist in the military to become citizens. Wanting to follow his girlfriend and friend, Johnny goes against his parents' desires and also enlists. But he finds that his grades are too low to join Carmen in Flight School and is assigned to the Mobile Infantry while Carl joins Military Intelligence.
Johnny and the rest of the new recruits are drilled by the brutal Career Sergeant Zim (Clancy Brown). Johnny shows himself to be an outstanding leader and is made squad leader. He also meets a former high school classmate, "Dizzy" Flores (Dina Meyer), who has requested transfer to Johnny's unit ostensibly because the unit is the toughest but mainly because she's infatuated with Johnny. Over the next few weeks in boot camp, Johnny learns that Carmen is happy with her training and is working with his high school rival, Zander (Patrick Muldoon). Her decision to make the Fleet her career dashes Johnny's dreams as well as the future of his romance with her. Following a training incident in which one of his squad members is killed, Johnny is demoted from squad leader and publicly flogged in accordance with military law. As Johnny is telling his parents via videophone that he is quitting the Infantry the transmission is interrupted. The 'Bugs' have directed an asteroid at Earth, destroying Buenos Aires, killing his parents and most of the population of that city. As a result of this sneak attack, Earth declares war on the 'Bugs' and Johnny stays with the Infantry.
The Federation's forces mount a large-scale invasion of Klendathu, which becomes an unmitigated disaster due to underestimation of their foes combat abilities. 'Bug plasma' energy discharges from the surface by huge 'Tanker Bugs' thought to be flame-spewing battle tanks on the surface now turn out to be giant artillery pieces capable of surface-to-space barrages creating massive damage to the Fleet in space.
With much of the Fleet in space destroyed or badly damaged, the Mobile Infantry on the surface now cut off from air support is overcome by swarms of thousands of 'Bug' warriors. Over 100,000 troops are killed before a retreat can be performed and several of Johnny's fellow recruits are killed, Johnny himself being severely wounded.
Later at the Ticonderoga Battle Station, where the remains of the Fleet dock, Carmen looks up Johnny Rico's name on a computer screen, (it shows over 308,000 casualties from the one-day battle). Johnny's squad is almost wiped out and Carmen, due to an error in the casualty list, believes he is dead.
Federation scientists are baffled by the Bugs' use of military tactics and postulate that there must be a caste of 'Brain Bugs' that serve as generals for the Arachnids.
After a few days' rest, Johnny, Dizzy, and fellow squad member Ace Levy (Jake Busey) are re-assigned to the 'Roughnecks', a special unit of Mobile Infantry which is led by Johnny's old high-school teacher, Lieutenant Jean Rasczak (Michael Ironside), a veteran of the First Bug War several years earlier who has been brought out of retirement to lead the group. Back on Earth, a new Sky Marshal revises the campaign, using strikes on other planets in the Klendathu system to learn more about the Arachnids' tactics. After aerial napalm strikes against the planets, Lt. Rasczak's squad lands on Planet 'P' to mop up. Johnny's leadership and his skill in combat while destroying a tanker bug earn him a field promotion to Corporal. That night, Lt. Raszcak grants the unit rest and relaxation, during which Johnny and Dizzy wind up in bed.
A few days later, the Roughnecks are assigned to investigate an outpost on Planet P; they find the garrison killed and learn that the Bugs have sucked out the brains of some of the dead. They find the cowardly Commanding Officer General Owen (Marshall Bell) still alive, rambling about the existence of some kind of leader bug responsible for the massacre. Suddenly, the outpost is ambushed by thousands of warrior bugs, with some tanker bugs in support. Most of the squad is killed, including General Owen, and Lt. Rasczak. Johnny takes command and requests an evacuation ship, which happens to be flown by Carmen and Zander. Dizzy is fatally stabbed by a warrior bug and dies in Johnny's arms.
After Dizzy's funeral aboard a starship, Johnny and Carmen are joined by Carl, now a high-ranking colonel in military intelligence. Carl admits that the Roughnecks had been used as bait to test a theory, which enrages Johnny, but the theory has proven correct; the existence of 'Brain Bugs' that control much of the Arachnid behaviour. Carl assigns the Roughnecks to search for a 'brain bug'. Carl gives Johnny a promotion to Lieutenant and command of the Roughnecks.
As the Roughnecks explore the surface of the planet, the Fleet in space is again fired upon by hundreds of planetary tanker bugs. During the attack the warship 'Rodger Young' on which Carmen is stationed as the pilot, is hit by Arachnid plasma energy fire. Cutting the ship in two, Carmen and Zander manage to evacuate in an escape pod that crashes deep inside a Bug nest several meters underground. Johnny learns of Carmen's situation and tells the rest of the squad to keep scouring the surface while he, Ace, and Sugar Watkins (Seth Gilliam) search for Carmen in the tunnels. Carl, who has telepathic powers, is able to provide Johnny some guidance through his mind. Eventually they discover Carmen and Zander just as Zander's brain is sucked out by the brain bug leader. Carmen saves herself by injuring the bug with a knife that Zander had handed to her earlier. Watkins, injured, sacrifices himself to wipe out the bug nest with a small nuclear warhead. Johnny, Ace and Carmen arrive on the surface and learn that the brain bug has been caught by the Mobile Infantry, led by former Sergeant Zim, who has been demoted to Private in order to take part in combat. As everyone celebrates, Carl joins Johnny and Carmen on the surface, explaining that they will be able to learn how the Bugs think and can turn the tide of the war.
Concluding with another propaganda News Reel, it is shown that Johnny, Ace, and Carmen continue their service in the military as heroes. Prime examples to incoming recruits with Johnny as leader of the 'Roughnecks' and Carmen as Captain of her own ship as the war against the bugs continues.