Missingno is a Pokémon in any Pokémon game that was replaced with a missing slot. When Pokémon Red/Green was first out, Gamefreak made mistakes on making Pokémon and they were placed in different places. But, they left empty slots behind. So when you speak to the guy who had his coffee and after the fight, it mixes your name with the old man's name. So your name was placed in the wild. You should have his name after that. Then fly to Cinnabar island because in the sea there was a empty slot with no Pokémon in the route, so when you surf you mix up your original name and acounter yourself as an empty slot in the wild.

This causes missingno to replace that empty slot becuase he's nothing more than a sad bunch of pixels and his Pokédex number is 000 :(

So thats why missingno was made.