Glitches don't just magically happen, although it might seem like it. And connecting a cable won't make a glitch on its own either. There are three different types of glitches that I can think of.
#1 - Hardware glitch
A problem with the cartridge itself. For example if it's exposed to too much heat it could damage the electronics inside. Or if it just gets worn out through a lot of usage! If you keep the cartridges safe then they will usually last for years and years. I still have my original Gameboy and games and they still work!
Being unable to save would fall into this category because the game tries to save the game the same way it normally does but the cartridge might be damaged and unable to save to that part of the memory.
#2 - Software glitch
This is a bug in the game. These usually happen when the programming comes across something it didn't expect. The early Pokemon games were notorious for things like the Missingno glitch. Many glitches happened because memory was tight and the cartridges only had 16 MB (megabytes) of memory to store the entire game.
For example the strip of land to the right of Cinnibar Island was mistakenly left "empty" in the wild encounter data, so it always showed Pokemon from the last area you visited (including the Safari Zone). When you speak to the old man it puts some special values in the encounter slot, then when you go to Cinnibar those cause an "unknown" Pokemon to appear.
#3 - Emulation glitch
This is incredibly common (and probably serves you right for pirating the game :p). Emulators try to replicate, in programming, everything that the hardware of a console does. It's very complex and so errors are common. The same goes for the games themselves. If a game is not copied 100% accurately it could break anything within the game.
And of course, many people hack the games to try and change things, like which Pokemon can appear where, and this can easily go bad if they change the wrong number. That's why we don't allow questions here on Emulators/ROMs because any problem that happens to you is likely a glitch with copying or modifying the ROM.