Is it illegal to download Sonic.exe? No. Because Sonic is copyrighted by Sega, distributing a fangame that uses his likeness without permission is a civil violation, not a criminal one. However, Sega has historically turned a blind eye to non-commercial fangames, as long as they don't use stolen code from actual ROMs.
However: Many "Sonic.exe game download" sites illegally bundle the game with a real Sonic 1 ROM. That is copyright infringement. The safest downloads use original art and custom engines. Sonic.exe Game Download
A popular mobile-friendly version exists that ports the original 2012 gameplay to Android APKs. However, these are high-risk downloads due to malware injection. Is it illegal to download Sonic
This is the most popular remake. It expands the original concept into a full-fledged survival horror game with multiple endings, new monsters (including a demonic Tails and Knuckles), and voice acting. However, Sega has historically turned a blind eye