One day, some time after the gods built Valhalla (the hall where warriors killed in battle get to feast with Odin) and Middle-Earth (the world of humans), a large man who claims to be a stone-mason arrives in Asgard (the land of the Aesir gods).
The stone-mason offers to build a huge wall around Asgard to keep out the giants (called Jotuns). But his work won't come cheap. As payment, he asks for the beautiful goddess Freyja, the sun, and the moon.
The gods hold counsel and decide to give the stone-mason what he asks for, but only if he succeeds in building the wall in a single season, entirely on his own. If he doesn't finish it by the first day of summer, then the gods won't pay him.
The stone-mason asks if he can have the help of his stallion, Svadilfari. At Loki's recommendation, the gods agree to this request.
On the first day of winter, the mason begins building the wall.
The gods are amazed at the strength of the mason's horse, who works all night long hauling huge boulders.
Three days before the winter's end, the mason has only the gate left to build.
Frantic at the thought of losing Freyja, the sun, and the moon, the gods meet to figure out what to do.
They're furious with Loki for recommending that they agree to let the mason use his horse, and threaten Loki with violence if he can't somehow prevent the mason from finishing his work.
Loki swears that he will find a way to keep the mason from finishing the wall.
That same evening, as the mason drives Svadilfari out to haul stones, a beautiful mare steps out of the woods and whinnies at the stallion. It's Loki, who has transformed himself into a lady-horse.
Svadilfari breaks free from the mason and follows the mare into the woods.
The mason chases after his horse all night, but can't get him back until the next morning.
When the mason sees that he won't be able to finish the wall in time, he flips out.
The gods now realize that the mason is actually a giant.
Despite having promised not to harm the mason, the gods call in Thor, the protector of Asgard, when they realize they have an out-of-control giant on their hands.
One blow from Thor's hammer smashes the mason's skull to bits, sending him to Hel. (Hel is the Norse underworld, not the burning hot, H-E-double-hockey-stick place.)
From the fling between Loki-as-mare and Svadilfari is born a baby horse with eight-legs: Odin's horse, Sleipnir.