Why did Sonic turn evil in epilouge?
Sonic has never turned evil in the Sonic the Hedgehog canon, including the epilogues of any games. You might be thinking of a fan fiction or a different kind of media.
Could you please provide more context? What specific game or story are you referring to? This would help me understand your question and give you a more accurate answer.