Flik, an individualist and would-be inventor, lives in a colony of ants in the middle of a dried creek. They are led by Princess Atta and her mother, the Queen. The colony is oppressed by a gang of marauding grasshoppers, led by Hopper, that arrive every season demanding food from the ants. One day, when the annual offering is inadvertently knocked into a stream by Flik’s latest invention, a grain harvesting device, the grasshoppers demand twice as much food as compensation. The ants trick Flik into accepting his plan to recruit “warrior bugs” to fight off the grasshoppers. While Flik actually believes in the plan, the other ants see it as an opportunity to get rid of Flik and not cause any trouble.
Making his way to the “big city” (a heap of trash under a trailer), Flik mistakes a group of circus bugs that have recently been dismissed by their money-hungry ringmaster, P.T. Flea, for the warrior bugs he seeks. The bugs, in turn, mistake Flik for a talent agent and accept his offer to travel with him back to Ant Island. After they arrive, the circus bugs and Flik both discover their mutual misunderstandings during a welcome performance by the ants. The circus bugs then attempt to leave but are forced back by a bird that attacks the group. They save Dot, Atta’s younger sister, from the bird as they flee, gaining the ants’ respect in the process. At Flik’s insistence, they continue the ruse of being “warriors” so the troupe can continue to enjoy the attention and hospitality of the ants. The bird encounter inspires Flik into creating a false bird to scare away the grasshoppers. While the bird is being built, Hopper reveals to the other grasshoppers how greatly the ants outnumber them and worries that they will eventually turn on them.
The bird is constructed, but during a celebration party, the truth about the circus bugs is revealed when P.T. Flea arrives searching for them. Outraged at Flik’s deception, the ants exile him and desperately gather food for a new offering to the grasshoppers. When the grasshoppers discover the mediocre offering upon their arrival, they take over the colony, demanding the ants’ winter store of food. After overhearing Hopper’s plan to kill the Queen, Dot has Flik and the circus bugs use the bird model to rescue the colony.
The bird nearly works, but P.T. Flea, also mistaking it for a real bird, lights it on fire, exposing it as a decoy. Hopper beats Flik in retaliation and proclaims that the ants are lowly life forms who live to serve the grasshoppers. However, Flik says that the ants are independent, without helping the grasshoppers. This inspires the entire colony along with the circus bugs to fend off the grasshoppers. The ants attempt to force Hopper out of the colony, but it suddenly begins to rain. In the ensuing chaos, Hopper kidnaps Flik and flees but Atta rescues Flik. As Hopper viciously pursues them, Flik corners him in the nest of the bird he encountered earlier. Mistaking the actual bird for another fake one, Hopper taunts it but is caught and fed alive to her chicks.
Later, Flik’s inventions are finally perfected and appreciated by the ants, and Atta professes her love for Flik. The ants congratulate Flik as a hero and bid a fond farewell to the circus troupe, hoping that they will return for the following year. Atta is crowned the new queen and Dot is crowned the new heir to the throne.