On Planet 51[N 1], green extraterrestrials live peacefully in a society reminiscent of the United States during the 1950s, although the planet's and their nature provide notable differences from Earth and, notably, ignorance about astronomy leads to believing that the whole Universe extends for almost 500 miles.
One day, a mysterious spacecraft lands in the city of Glipforg. NASA[N 2] astronaut Charles "Chuck" Baker emerges from it and is shocked to find the planet inhabited. Panicked, Chuck escapes to the town's planetarium, where he meets teenage alien Lem, who works there part-time. Chuck convinces Lem to help return him to his spacecraft before command module Odyssey in Planet 51's orbit departs for Earth in three days and leaves him stranded. Planet 51's army, led by the paranoid General Grawl, arrives to inspect and deduces that the astronaut is an alien invader bent on turning the planet's population into zombies, similar to how invaders are depicted in media, and a manhunt ensues.
Lem enlists the help of his best friend Skiff, an eccentric science fiction aficionado with conspiracy theories about the so-called "Base 9" (Planet 51's equivalent of Area 51), to hide Chuck away from the army. During his efforts to conceal Chuck, Lem inadvertently upsets his neighbor and crush Neera, who believes the alien is friendly, and is also fired from his job when his boss discovers Chuck. In Lem's room, Chuck reunites with a dog-like NASA probe called Rover, which freed itself from the army's base after tracking Chuck with a GPS and headed for the city and which befriends a small, domesticated Xenomorph. After the army searches Lem's home for traces of the alien, Lem and Skiff move Chuck to a comic book store Skiff works at, where the news station manages to capture Chuck acting out references to Earth's pop culture, which is misinterpreted as alien threats. After escaping the store from the invading army, Grawl has Chuck's spacecraft moved to a secret location. Chuck is later captured by Grawl's forces during a festive movie premiere in town, and is slated to have his brain removed by alien scientist Professor Kipple. When Lem defends Chuck, Kipple deems him a zombie minion. Resigned to his fate, Chuck pretends to release Lem from his "mind control" and is taken away with Rover to Base 9.
Lem gets his job back, but is determined to rescue Chuck. Joined by Skiff, Neera, her younger brother Eckle, and Rover, Lem tracks down Base 9's location in the desert to a gas station where Skiff inadvertently opens a gate to the underground base. They free Chuck from Kipple and find his spacecraft, but they are cornered by Grawl and his forces. Bent on eliminating the human, Grawl reveals he has the base rigged to explode. Lem attempts to reason with The General to not shot Chuck but inadvertently activates the countdown. Enraged, Grawl attempts to shoot Lem, but Eckle tosses a hook to him and ignites an explosive, causing him to be trapped under debris. Chuck rescues him before launching his spacecraft into Planet 51's orbit, escaping Base 9's destruction. After admiring Planet 51's view from space, Lem successfully asks Neera out on a date, while Grawl expresses his gratitude to Chuck for saving him. Chuck returns his friends home and allows Rover to stay behind with Skiff, who has bonded with the probe, and bids Lem and the rest of the town farewell before launching back into space, but the last seconds of the film reveal that the little Xenomorph pet befriended by Rover is on board.
In a mid-credits scene, Kipple climbs out of the underground base, but is taken back to his own lab for brain surgery by two of his own patients, whom he wrongly deemed to be mind controlled by Chuck earlier in the movie. Meanwhile, Chuck is stuck being licked by the alien pet as he comments that 'this is going to be a long trip'.