Here is a full explaination to how it occurs, derived from wikipedia. I take no credit for this.
"Encountering a MissingNo. Pokémon is the result of three computing events. The first is the game's random battle encounter system: each area assigns values to Pokémon in a data buffer, which the game accesses for the player's encounters with wild Pokémon. However, no values are assigned to this buffer on the east coast of the Cinnabar and Seafoam Island locations—the information from the previously visited area is used instead. The second factor is the in-game tutorial, which temporarily stores the player's name in the data buffer. This causes the game to access thehexadecimal values of the player's name for Pokémon encounters at Cinnabar and Seafoam Island. The third factor is the game's error handling system; if the game selects a value from the data buffer that is not an existing Pokémon, a subroutine is triggered that causes the appearance of a Pokémon named MissingNo., short for "Missing Number". As with any wild Pokémon, players may flee from, fight or capture MissingNo. After an encounter with MissingNo., the quantity of the sixth item in the player's item menu is increased by 128, and the game's Hall of Fame Pokémon gallery becomes permanently glitched. Temporary graphical glitches may also occur, which can be removed by viewing the statistics page for another Pokémon or resetting the console. A captured MissingNo. is a fully functional Pokémon, and appears in the game's Pokémon index as number 000. All MissingNo. possess consistent abilities, type, statistics and sounds. The Pokémon commonly appears as a scrambled "d"-shape, but certain encounter values cause it to appear as one of three sprites not used by other Pokémon."
Here is a full explaination to how it occurs, derived from wikipedia. I take no credit for this.
"Encountering a MissingNo. Pokémon is the result of three computing events. The first is the game's random battle encounter system: each area assigns values to Pokémon in a data buffer, which the game accesses for the player's encounters with wild Pokémon. However, no values are assigned to this buffer on the east coast of the Cinnabar and Seafoam Island locations—the information from the previously visited area is used instead. The second factor is the in-game tutorial, which temporarily stores the player's name in the data buffer. This causes the game to access thehexadecimal values of the player's name for Pokémon encounters at Cinnabar and Seafoam Island. The third factor is the game's error handling system; if the game selects a value from the data buffer that is not an existing Pokémon, a subroutine is triggered that causes the appearance of a Pokémon named MissingNo., short for "Missing Number". As with any wild Pokémon, players may flee from, fight or capture MissingNo. After an encounter with MissingNo., the quantity of the sixth item in the player's item menu is increased by 128, and the game's Hall of Fame Pokémon gallery becomes permanently glitched. Temporary graphical glitches may also occur, which can be removed by viewing the statistics page for another Pokémon or resetting the console. A captured MissingNo. is a fully functional Pokémon, and appears in the game's Pokémon index as number 000. All MissingNo. possess consistent abilities, type, statistics and sounds. The Pokémon commonly appears as a scrambled "d"-shape, but certain encounter values cause it to appear as one of three sprites not used by other Pokémon."