The film centers on the cast of a once-popular television space-drama series called Galaxy Quest. The fictional series starred Jason Nesmith (Allen) as the commander of a spaceship called the NSEA Protector, Alexander Dane (Rickman) as the ship's alien science officer, Fred Kwan (Shalhoub) as the chief engineer, Gwen DeMarco (Weaver) as the computer officer, and Tommy Webber (Mitchell) as a precocious child pilot. Guy Fleegman (Rockwell) played an unnamed security officer who was quickly killed off in his only appearance on the show.
Eighteen years after the show was cancelled, as a Galaxy Quest convention full of dedicated fans is underway, Jason is approached by a group of people whose leader, Mathesar, says that they are aliens called "Thermians". Jason goes with them to what he assumes will be an amateur filming session, but the Thermians really are aliens, octopoidal creatures using a device that makes them appear human. Technologically advanced but having no concept of fiction, they have mistaken broadcasts of Galaxy Quest for historical documentaries and modelled their society on the ethos presented in the episodes. They have invented and built real fully functional versions of the technologies portrayed in the show, including the Protector.
The Thermians transport Jason onto the Protector to negotiate with Sarris, a reptilian humanoid warlord waging a genocidal war against the Thermian people. Sarris demands the Omega 13, a device used at the very end of Galaxy Quest's final episode. Still believing the situation is fictional, Jason casually orders the Thermians to fire upon Sarris's spaceship and then insists on returning home, but when they teleport him through space to Earth, he finally realizes the events were real. The Thermians then come back to Earth and ask for more help negotiating a surrender with Sarris. Jason, believing Sarris is the one surrendering, asks his co-stars to join him, and they agree, believing that the mission is just an acting job. Once the actors are aboard the Protector, they finally realize the truth, but Sarris prevents them from leaving, so they assume their television roles in order to save the Thermians.
However, they are not competent at controlling a real ship, and their encounter with Sarris goes poorly. They escape by flying through a minefield, which damages the beryllium sphere that powers the ship's reactor. The actors acquire a new sphere from a nearby planet after battling various alien creatures, but when they return to the ship, Sarris has boarded it and taken control. Sarris interrogates Jason about the Omega 13 and forces him to admit the truth about Galaxy Quest to Mathesar, who is heartbroken, equating acting with deception and lies. Sarris's men activate the ship's self-destruct sequence, but Jason and Alexander use a gambit from one of the show's episodes to kill the aliens guarding them.
Not knowing how the ship works, Jason contacts an avid Galaxy Quest fan named Brandon in his suburban home on Earth, using one of the Thermians' Vox communicators that he accidentally swapped at a promotional store opening. Brandon and his friends use their extensive knowledge of the ship to help Jason and Gwen abort the self-destruct sequence. When Jason asks Brandon what the Omega 13 does, Brandon says that while some people believe it was a bomb capable of destroying all matter in the universe in 13 seconds, he and others believe it is a time machine that sends its user 13 seconds into the past ("enough time to redeem a single mistake," as Jason observes).
With Jason in command of the Protector, the actors and Thermians destroy Sarris' ship and set course back to Earth. Sarris sneaks aboard the Protector and starts killing the crew, but Jason activates the Omega 13, is sent back in time 13 seconds, and thwarts his attack. As the Thermians take control of the ship, the actors detach the command deck and land on Earth with Brandon's help, accidentally crashing into the building where the Galaxy Quest convention is taking place. They emerge from the wreck to enthusiastic applause from the audience, who assume the crash is part of the entertainment, and when Sarris attacks again, Jason disintegrates him with a blaster pistol and receives even greater applause. Later that year Galaxy Quest is revived, starring the original cast, along with Laliari, a female Thermian who chose to stay on Earth as Fred's lover, and with Guy playing a new role as the ship's chief of security.