Computers see everything as a series of ones and zeroes. No matter what your computer is doing its memory is filled up with nothing but a series of bits that can be set to either on or off. As computers have grown more complex, more layers of complexity have been added, but those layers themselves are just more ones and zeroes themselves.
One might begin to wonder what happens when you put the wrong series of ones and zeroes somewhere.
With more modern computers I'd expect there'd be -error-checking mechanisms in place to ensure that accidental memory corruption doesn't lead to wild out-of-control junk execution, but older machines have no such sophistication. Such is the case of the 6502...
Each command in the 6502's operating language is one byte in length. This gives a possible count of 256 such commands, but only 151 values are used. (There's also only 151 Pokemon in the first games- coincidence? Probably)
this post is unfinished, so here's some cool links:
https://www.pagetable.com/?p=39
http://bbc.nvg.org/doc/6502OpList.txt
https://www.masswerk.at/nowgobang/2021/6502-illegal-opcodes