E-102 Gamma is one of Doctor Eggman's robots, built as part of the E-100 series that began with E-101 Beta and ran through to E-106. Their purpose was to locate the Chaos Emeralds, strengthen Chaos and eliminate Sonic and his friends.
Gamma's story turns after an encounter with Amy. Something goes wrong with his programming, and in its place he develops what can only be described as a conscience.
That shift sends him on a new mission: tracking down his banished brothers in order to free them from Eggman's control. He succeeds, but is fatally wounded by his older brother Beta. Limping away, Gamma collapses and explodes. Whether that end came from his damage or from a choice of his own is never made clear.