It seems that in emulators such as Dolphin, cheats are way more stable. On real GameCube hardware, it sometimes crashes. Example: exits out of bounds area in mario sunshine on an emulator (works ok) exits out of bounds area in mario sunshine on a wii (crashes) (Yes, the Wii is considered GameCube hardware because it doesn't emulate games. That would be next to impossible to emulate with good results with the horsepower of the Wii.) So why does this happen? Just curious

It happens because of inaccuracies in dolphin that can permit say invalid memory accesses to continue whereas on real hardware it will crash. Dolphin can also apply cheats without requiring the game to change its execution whereas real hardware will need an in memory hook to call upon a custom code handler at basically every frame, this can cause oddities and instabilities as now the game is executing additional code beyond what is expected.

Although specifically with Mario Sunshine there's a crash that can occur on real hardware I believe if you manage to angle the camera at a certain location in a certain level, maybe you were just unlucky and stumbled across that.

Honestly, most people have the opposite experience. Dolphin's codehandler doesn't behave the same as a real AR codehandler, so many codes that work fine on real hardware will crash Dolphin or behave incorrectly.