The emulator itself is legal — clean, self-written emulation software is not infringing anything. ROMs are where it gets murky: downloading a game you do not own the cartridge for is copyright infringement in most jurisdictions, and Sonic 1 Megamix is an unreleased fan-made build, which puts it in a grey area rather than a clearly safe one.
The more immediate problem is risk. Sites that host prototype ROMs are a favourite distribution point for malware, and this particular download is a well-known example — a trojan is exactly what turns up in place of the game.