The weirdest for me was playing Final Fantasy III on the SNES back in the day, and stumbling upon the Sketch glitch without realizing what had happened.

For those who don't know, Sketch is an ability where you select an enemy and "sketch" it, causing you to instantly use one of its abilities against your enemies. The problem is that when Sketch misses for whatever reason (e.g. spells that cause your target to turn invisible), the game bugs out, and things got weird, usually in a very game-breaking way.

Years later, I found out that this happened because of the way the ability was coded in ASM; when Sketch missed, the algorithm would reference a memory address that contained junk data, and different things would happen, depending on the stored values.