Minecraft was originally based on a game made by Markus Persson (Notch) called RubyDung although not much is known about RubyDung is was supposed to be like a base building type game.Also the grass and cobblestone textures were later used in minecraft and in earlier versions of minecraft it was actually called RubyDung.
Later Markus (Notch) stumbled into an indie game called Infini Miner and thought that the building mechanics in this game were fun but they lacked variety this inspired Markus to make a first person fantasy game that had terrain aspects of RubyDung and other aspects of this game came from a pc game called dungeon keeper, a game where u build things and exploring dungeons. He used the block like texture character model from one of his earlier projects called Zombie Town which was the source of minecraft mobs.But when Minecraft released Markus hadn't decided on a name yet a just called it "Cave Game". The first official game for Minecraft was Minecraft Order of the Stone which referenced to a web comic called Order of the stick.Later the Minecrafts name was shortened to just Minecraft for a more simple name and to make it not be confused with Order of the stick web comic.After Markus was done with the main mechanics of the game he started working with the multiplayer aspect of the game and had an idea to start adding animals into minecraft,when make a model from the pigs he accidentally mixed up the x and y axis on the pigs body. which looked like this