The Trade Federation upsets order in the Galactic Republic by blockading the planet Naboo in preparation for a full-scale invasion. The Republic's leader, Supreme Chancellor Valorum, dispatches Jedi Master Qui-Gon Jinn, and his apprentice, Obi-Wan Kenobi, to negotiate with the Trade Federation Viceroy, Nute Gunray. Darth Sidious, a Sith Lord and the Trade Federation's secret benefactor, orders the Viceroy to kill the Jedi and begin their invasion with an army of battle droids. The Jedi escape and flee to Naboo. During the invasion, Qui-Gon saves the life of a clumsy Gungan outcast, Jar Jar Binks, from being run over and killed by a droid transport. Indebted to Qui-Gon, Jar Jar leads the Jedi to Otoh Gunga; an underwater Gungan city. The Jedi unsuccessfully try to persuade the Gungan leader, Boss Nass, into helping the people of Naboo; but he is not interested due to disliking the humans on the surface. However, the Jedi do manage to obtain underwater transport to Theed, the capital city on the surface, narrowly avoiding getting eaten by sea monsters on the way. They rescue Queen Padmé Amidala, the ruler of the Naboo people, and escape from the blockaded planet on her Royal Starship en route to the Republic capital planet of Coruscant.
Amidala's ship is damaged as they pass the Federation blockade and the hyperdrive is caught in the crossfire; rendering it useless. They land for repairs on the desert planet Tatooine, but Captain Panaka, one of the Queen's bodyguards, expresses his disapproval due to Tattooine being Hutt territory. Qui-Gon, Jar Jar, astromech droid R2-D2, and Padmé—disguised as one of her handmaidens—visit the settlement of Mos Espa to purchase spare parts at a junk shop. They meet the shop's Toydarian owner, Watto, and his nine-year-old slave, Anakin Skywalker, who is a gifted pilot and engineer, and who has built a protocol droid called C-3PO. Qui-Gon senses a strong presence of the Force within Anakin, and is convinced that he is the "chosen one" of the Jedi prophecy who will bring balance to the Force. Unable to buy the required hyperdrive parts due to the Republic's currency being worthless on Tatooine, Qui-Gon wagers both the parts and Anakin's freedom with Watto in a Podrace. Anakin wins, to the surprise of Watto, who lost all his money betting on the reigning champion, Sebulba. Anakin joins the group to be trained as a Jedi, leaving behind his mother, Shmi. En route to their starship, Qui-Gon encounters Darth Maul, Darth Sidious' apprentice, who was sent to capture Amidala. A duel ensues, but Qui-Gon quickly disengages and escapes onboard the starship.
Qui-Gon and Obi-Wan escort Amidala to Coruscant so that she can plead her people's case to Chancellor Valorum and the Galactic Senate. Qui-Gon asks the Jedi Council for permission to train Anakin as a Jedi, but the Council refuses, concerned that Anakin is vulnerable to the dark side of the Force. Undaunted, Qui-Gon wants to relieve Obi-Wan from his tutorship and take up Anakin as his new disciple. Meanwhile, Naboo's Senator Palpatine persuades Amidala to cast a vote of no confidence in Chancellor Valorum to elect a more capable chancellor to resolve the crisis on Naboo. Though she is successful in pushing for the vote, Amidala grows frustrated with the corruption in the Senate and decides to return to Naboo. Qui-Gon and Obi-Wan are ordered by the Jedi Council to accompany the queen to Naboo, as well as to confirm the return of the Sith, whom they believed to be extinct.
On Naboo, Padmé reveals herself to the Gungans as Queen Amidala, and persuades them into forming an alliance against the Trade Federation. Jar Jar joins his people in a battle, despite being inept at combat, against the droid army while Padmé leads the search for Viceroy Gunray in Theed. During a battle in the Royal Starship hangar to free Naboo pilots, Anakin is told to wait in the cockpit of a vacant starfighter by Qui-Gon Jinn, and inadvertently triggers it's autopilot, joining the battle against the Federation droid control ship in space. Anakin blunders into the hangar of the droid control ship and destroys the ship from within before escaping, deactivating the entire droid army on the surface. Meanwhile, Qui-Gon and Obi-Wan battle Darth Maul, who mortally wounds Qui-Gon, but is eventually bisected by Obi-Wan and falls down a reactor shaft.
Just before he dies, Qui-Gon requests that Obi-Wan train Anakin. Subsequently, Palpatine is elected as the new Supreme Chancellor, and Gunray is arrested. Yoda promotes Obi-Wan to the rank of Jedi Knight and reluctantly accepts Anakin as Obi-Wan's apprentice. Padmé presents a gift of appreciation and friendship to the Gungans at a festive ceremony, highlighting the newfound unity between the Gungans and the people of the surface of Naboo.