Demon King Demise was punished by the Goddess Hylia when he attempted to take the Triforce and was trapped within the form of a giant monster known as the Imprisoned. However, his sword assumes the form of the arrogant Ghirahim, tries to track down Hylia's reincarnation Zelda so he can use her life force to restore Demise to his true form. Impressed to see a human like Link willing to stand up to him, Demise decides to battle him out of amusement. Mortally wounded as Link manages to restore Zelda's soul to her body, Demise's remains are sealed away within the Master Sword. However, Demise's final words speak of a new incarnation of his malice living on, alluding to Ganondorf and the bonds that tie him with Zelda and Link's descendants.
Source: Wikipedia, "Characters in The Legend of Zelda series," available under the CC-BY-SA License.