Introduction
Ymir is the first living being in Norse cosmology, a primordial frost giant (jotunn) formed when the fire of Muspelheim met the ice of Niflheim in the great void of Ginnungagap. His death at the hands of Odin and his brothers is the founding act of creation: the world itself is built from his body.
This article follows Old Norse mythological tradition, chiefly the Poetic Edda and Snorri Sturluson's Prose Edda, noting where the two sources differ.
Formation
Between the fiery realm of Muspelheim and the frozen realm of Niflheim lay Ginnungagap, a vast, yawning void. Where the heat of Muspelheim's sparks met the rime of Niflheim's ice, the melting drops quickened into life, and Ymir was formed, the ancestor of all the giants.
Nourishment and the first gods
Ymir was fed by the milk of the primordial cow Audhumbla, who in turn licked the salty ice blocks of Ginnungagap for nourishment. Over three days of licking, Audhumbla freed a man, Buri, from the ice; Buri's son Bor, with the giantess Bestla, fathered Odin and his brothers Vili and Ve, the first of the Aesir gods. Ymir himself, meanwhile, produced offspring asexually: a man and woman grew from his armpit as he slept, and one of his legs bred a son with the other, giving rise to the race of frost giants.
Death and the creation of the world
Odin, Vili and Ve killed Ymir and used his enormous body to construct the physical world: his flesh became the earth, his blood the sea and lakes, his bones the mountains, his teeth and broken bone fragments the rocks and stones, his skull the dome of the sky (held up at its four corners by four dwarves), and his brains the clouds. His eyebrows were used to build a defensive wall around Midgard, the realm of humans, to keep the giants at bay.
Meaning
Ymir's death and dismemberment to form the cosmos is an example of a widespread mythological pattern, the "cosmogonic sacrifice", found across many Indo-European traditions, in which the created world is built from the body of a primordial being.