Some games will stop you when you reach a far enough distance - like if your position can no longer be represented by a 32bit integer.
Sonic 3 converts your position to a smaller bit, which means if you go beyond or behind the borders of the map the geometry starts to loop... this is known as the Loopback Area in Sonic 3 speedrunning circles.
Some games, particularly on the Gameboy, will just pull map data out of the next available RAM address and fill your screen with garbage (Mario Land 2 does this)
Ahhh ok it's starting to make sense to me now. I've just always been interested in stupid stuff like this because my knowledge of programming is shit