At the beginning of Shadow the Hedgehog, which takes place three months after the events of Sonic Heroes, Shadow, still suffering from amnesia, remembers only two things: his name and "that gruesome image" of his attempt to escape the space station ARK with Gerald Robotnik's granddaughter Maria and her death by gunshot from G.U.N. soldiers.[13] He wonders whether he is an android due to hints given in Sonic Heroes.[11] The game begins with Shadow reminiscing outside the city of Westopolis when the Black Arms drop out of the sky and invade it. Doom's Eye approaches Shadow, and Black Doom tells Shadow of an old agreement for Shadow to bring him the Chaos Emeralds.[10][14] Stunned that Black Doom knew his name, Shadow realizes that he must find the Chaos Emeralds to learn his past.[15]

The game progresses through the Westopolis level and five more levels from the different paths Shadow can take. As missions are completed, Shadow learns more of his past.[1][11] He can choose to help the Black Arms or Doctor Eggman (Dark), to help G.U.N. and the series' heroic characters (Hero),[10] or to help neither and keep the Chaos Emeralds for himself (Neutral).[7] The missions completed determine which one of ten possible endings will be seen after Shadow collects all the Chaos Emeralds and defeats one of the game's final bosses.[16] The possible ending events range from planning to defeat the Black Arms[17] to planning to destroy the planet.[18]

Completing all ten endings unlocks a final ending in which Black Doom uses Chaos Control, enhanced by the power of all seven Chaos Emeralds, to bring the Black Comet to Earth. Shadow then confronts Black Doom on the "Last Way" level, where he discovers that Professor Gerald Robotnik created the ARK's Eclipse Cannon weapon to destroy the Black Comet.[19] During their confrontation, Black Doom attempts to control Shadow through mind control but fails,[20] prompting him to transform into his "Devil Doom" form.[21] In response, Shadow uses the Chaos Emeralds to transform into his "Super Shadow" form and defeats Black Doom.[22] Shadow then transports the Black Comet into outer space using Chaos Control and obliterates it with the ARK's Eclipse Cannon.[23] His friends are elated,[24] as are people at G.U.N. headquarters.[25] Shadow is then shown in the ARK's control room holding up a photograph of Maria and Gerald. He discards the photograph, declaring "Goodbye forever... Shadow the Hedgehog," and leaves the room.[26]