Shadow the Hedgehog.
Not really a villain per se, but an antagonist introduction. Grieved with the loss of his only friend, he saw humanity as pure evil, and sought to destroy the planet by crashing a space station into it. Only through interactions with the protagonists did he see that there is good in the world worth saving, and he gave his life to undo the damage he caused.
There’s a lot more to it, but that’s the summary.