Image from the original Game Genie patent.
Ultimately it’s a fairly simple device that uses 6 and 8 bit codes entered to probe data bytes in the game and change during gameplay. This is distinct from other similar products like the Game Shark/Action Replay that patched active RAM instead of ROM.
This Mental Floss article gives some really amazing history for the product, including Nintendo’s 1991 lawsuit that attempted (and failed) to discontinue the device.
And if you want a no-nonsense nuts and bolts breakdown of how the device worked, here’s an intimidating text post.