In 1988, following his mother's death, a young Peter Quill is abducted from Earth by the Ravagers, a group of space pirates led by Yondu Udonta. Twenty-six years later on the planet Morag, Quill steals an orb, after which Korath, a subordinate to the fanatical Kree, Ronan, intercepts him. Although Quill escapes with the orb, Yondu discovers his theft and issues a bounty for his capture, while Ronan sends the assassin Gamora after the orb.
When Quill attempts to sell the orb on the Nova Empire capital world, Xandar, Gamora ambushes him and steals it. A fight ensues, drawing in a pair of bounty hunters: the genetically engineered raccoon Rocket, and the tree-like humanoid Groot. The Nova Corps arrives and arrests all four, imprisoning them in the Kyln. While there, a powerful inmate, Drax, attempts to kill Gamora due to her association with Ronan, who killed his family. Quill convinces Drax that Gamora can bring Ronan to him. Gamora reveals that she has betrayed Ronan, unwilling to let him use the orb's power to destroy planets, starting with Xandar. Learning that Gamora has a buyer for the orb, she, Quill, Rocket, Groot, and Drax work together to escape from the Kyln.
Elsewhere, Ronan meets with Gamora's adoptive father, Thanos, to discuss her betrayal. Accompanied by Drax, Quill's group escapes the Kyln in his ship – the Milano – and flees to Knowhere, a remote criminal outpost in space built in the giant severed-head of a Celestial. A drunken Drax summons Ronan while the rest of the group meet Gamora's contact, the collector Taneleer Tivan. Tivan opens the orb, revealing an Infinity Stone, an item of immeasurable power that destroys all but the most powerful beings who wield it. Suddenly, Tivan's tormented assistant grabs the Stone, triggering an explosion that engulfs Tivan's archive.
Ronan arrives and easily defeats Drax, while the others flee by ship, pursued by Ronan's followers and Gamora's sister Nebula. Nebula destroys Gamora's ship, leaving her floating in space, and Ronan's forces capture the orb. Quill contacts Yondu before following Gamora into space, giving her his helmet to survive; Yondu arrives and retrieves the pair. Rocket, Drax, and Groot threaten to attack Yondu's ship to rescue them, but Quill negotiates a truce by convincing Yondu that they can recover the orb. Quill's group agrees that facing Ronan means certain death, but that they cannot let him use the Infinity Stone to destroy the galaxy. On Ronan's flagship, the Dark Aster, Ronan embeds the Stone in his warhammer, taking its power for himself. He contacts Thanos, threatening to kill him after the destruction of Xandar; hateful of her adopted father, Nebula allies with Ronan.
Near Xandar, the Ravagers, the Nova Corps, and Quill’s group, which breaches the Dark Aster, confront the Dark Aster. Ronan uses his empowered warhammer to destroy the Nova Corps fleet. On the Dark Aster, after Gamora defeats Nebula (who escapes), she unlocks Ronan's chambers, but the group find themselves outmatched by his power until Rocket crashes the Milano through the Dark Aster. The damaged Dark Aster crash-lands on Xandar, with Groot sacrificing himself to shield the group. Ronan emerges from the wreck and prepares to destroy Xandar, but Quill distracts him, allowing Drax and Rocket to destroy Ronan's warhammer. Quill grabs the freed Stone, and with Gamora, Drax, and Rocket sharing its burden, they use it to destroy Ronan.
In the aftermath, Quill tricks Yondu into taking a container supposedly containing the Stone, and gives the real Stone to the Nova Corps. As the Ravagers leave Xandar, Yondu remarks that it turned out well that they did not deliver Quill to his father per their contract. Quill's group, now known as the Guardians of the Galaxy, have their criminal records expunged, and Quill learns that he is only half-human, his father being part of an ancient, unknown species. Quill finally opens the last present he received from his mother: a cassette tape filled with her favorite songs. The Guardians leave in the rebuilt Milano along with a sapling cut from Groot.
In a post-credits scene, Tivan sits in his destroyed archive with two of his living exhibits: a canine cosmonaut and an anthropomorphic duck.