Ymir (or Ímir depending on the source) was the first of the Jötunn race and the first being to exist in the ancient Norse mythology. Acting as a true savage animal, he was described as the "most destructive" of his species. Midgard, Asgard and all the other worlds except Muspelheim and Niflheim were made of his flesh and blood.
Ymir is said to be a ruthless, brute and savage creature and a chaotic universal force, sometimes described as a true animal moved only by instinct. He attempted to kill the Aesir lineage to maintain his rule over the "pre-universe".
In an ancient time long before the universe existed, there was an empty void of nothingness. Only two "things", or realms, existed at this times: the fire realm Muspelheim and the ice realm Niflheim. There was a infinite abyss between the two called Ginnungagap.
At some point, the cold and poisonous mist of Niflheim and the hot embers of Muspelheim collided in the unending abyss of Ginnungagap. This generated a cube of ice that started to melt and gain the shape of a giant hermaphrodite creature. This primordial god named itself Ymir, and it was the first of the Jötnar.
While sleeping, from the wet of it's armpits emerged a couple of giants, and from it's lags a giant with six heads with the name of Thrudgelmir was born. This giant later gave birth to Belgemir, Ymir's grandson who'll repopulate the giant race.
Later, a second being came from Ginnungagap, the same way as Ymir did. It's name was Audhumbla, a giant female aurochs who feed Ymir with her milk. This other primordial deity later generate Buri, the first of the Aesir gods, wich them generated a divine lineage that will enter in conflict with the descendants of Ymir.
Odin, Vili and Ve, Buri's grandsons, slayed Ymir in the first battle of all, and his death caused a blood flood that killed almost all of the jotnar drowned, except for his grandson Belgemir, who moved to Jotunheim with the promise of avenge his ancestors.