is a German Fairy Tale
collected by The Brothers Grimm
— sometimes translated Iron John
In a wood where no one who goes in, ever comes out, a huntsman captures a wild man by draining the pool he was hiding in. The king keeps him in a cage and threatens death to anyone who lets him out. The prince's ball falls into the cage, and the wild man tricks the boy into getting the key and letting him out, then he carries him off to prevent his being punished for it.
In the forest he sets him to watch a well and make sure nothing falls in. The prince tries three times and fails each one, ending up with his hair turned to gold. The wild man sends him away, but tells him if he calls his name "Iron Hans" he will come to help him.
Hiding his hair beneath a cap, the prince found a menial position at court — demoted from working in the kitchen to the garden when he claimed to have a sore on his head to keep the hair concealed. The princess glimpsed his hair one day and ordered him to bring her a wreath of flowers; then she pulls off his cap and is certain that it's him.
The country is threatened with war. The prince calls upon Iron Hans, who gives him a horse and a troop of soldiers, and he secures the king's victory, and flees before he is caught out. The king has a great feast in which his daughter will throw out a golden apple in hopes that the strange knight will catch it. The prince calls on Iron Hans, catches it on the horse he is given, and rides off. This happens three times, but he is wounded the third, and they see his golden hair. This gives away that he's the gardener's boy, and they bring him before the throne. He reveals he's a prince and asks to marry the princess.
At their wedding, a strange man appears: he reveals that he was Iron Hans, who had been an enchanted king, but the prince has disenchanted him and will receive everything he owns for it.
It is one of the fairy tales retold in Erstwhile.
Full text here