Basically an ice elemental named Evergreen that is some kind of bird-hybrid looking creature and that strongly resembles the Ice King transformation created the crown with a mix of science, magic, and three mystic rubies he stole that were the eyes of some kind of lava beast to make a wish and stop a comet that would wipe out life on Earth that had curling horn tails that looked lick the lich in the time of the dinosaurs. He had an apprentice that Gunter that worshiped him and followed him around that he treated like crap and never really taught him anything. Just as he finished the crown the beast he stole the eyes/rubies from attacked his tower and destroyed a few columns, killing the creature and trapping Evergreen. Gunter was unhurt and next to the crown. At first Evergreen told him to throw him the crown, then realized it wasn't possible from the positions they were in and told Gunter to make put it on and focus on his greatest wish to make the comet go away. Unfortunately, Gunter's greatest wish was to be like Evergreen, so he starts growing his long nose, beard, white hair, blue skin, etc. It ends with Gunter screaming "Gunter, no" repeatedly, mimicking how Evergreen would scold him and Evergreen realizing how screwed he was because he never taught his apprentice anything.
Then you find out the whole thing was a dream of Ice King's, one he implies that he as often, after he wakes up and notices all the penguins cowering in the corner of his bedroom shivering. We have to assume it is the actual history of the crown imprinting itself on his mind. And we see another comet approaching Ooo in the distance, which might be what is prompting the dreams.