At the end of Shadow the Hedgehog's self-titled game, he and Sonic beat the final boss together, and Shadow chose to sacrifice himself to save the planet. He fell back to Earth, and the combination of the energy released and the impact of the crash wiped his memory clean.
That amnesia is what sets up his return in later titles, where he spends a good while trying to piece together who he actually is.