Action Replay codes on GameCube are stored in the Action Replay device's internal memory—not on the console, not on a memory card (by default), and not on the game disc. The device is a physical cartridge that plugs into Memory Card Slot A; its onboard flash memory holds your code database.
Codes can break games, crash the console, or corrupt memory card saves. "Walk through walls" codes often trap you in voids. "Infinite health" can break scripted death sequences. Always back up your memory card saves (via GCMM on Wii/homebrew) before using codes. Use at your own risk.