Thor threatens Loki with violence after he cut off his wife Sif's golden hair. Loki begs Thor to let him go down to Svartalfheim , the home of the dwarves, to see if they could craft a new head of hair.
Loki gets the head of hair along with other gifts but decides to cause some mischief and strikes a deal the dwarf brothers, Brokkr and Sindri, that if they could create better gifts than the dwarf who crafted the head of hair and other gifts.
Loki interferes with the brother's creation processes, under the guise of a fly, but they manage to still craft quality gifts.In the final creation process the brothers craft Thor's iconic hammer Mjolnir even with Loki's annoyance.
Loki presents the gifts made by the dwarf brothers before the gods.
The gods love the gifts , particularly Mjolnir, and concluded that Loki would need to pay his head to the dwarf brothers to honor his deal.
Loki states that he said his head and not his neck. However the dwarf brothers were content with sewing his mouth shut.