"The Seven-headed Serpent" is a Greek fairy tale collected, as "Die Siebenkopfige Schlange," in Bernhard Schmidt's Griechische Mahrchen. Andrew Lang included it in The Yellow Fairy Book.
The Seven-headed Serpent Wikipedia
A king went on a sea voyage. His ship was blown to an island, where they were attacked by lions who killed many of the King's men. They eventually come to a garden with fountains of gold, silver, and pearls, with a large castle and lake nearby. The Lake warned them that the seven-headed serpent-king of the island would soon wake and bathe in it; it would devour the men alive if they were found. The only way they could limit their punishment was to spread their clothing over its path, as the softness would appease it. When it discovers the men and what they have done to soften his path, in exchange for their lives the serpent demanded twelve youths and twelve maidens every year, or it would destroy their country. For many years, brave youths and maiden volunteered to save their country, yet all perished.
The king and queen in the meantime had no children. One day, an old woman from the Spinning Convent offered the queen an apple that would give her a child. The queen ate the apple, and threw the peel into a pasture where a mare ate it. She had a son, and the mare a foal. When the prince and the horse were grown, the horse said the sacrifice would soon ruin the country and had the prince ride it to the Spinning Convent where the abbess was spinning. She told him to take cotton and go by a secret tunnel to the serpent's palace. There, he would find it sleeping in a bed, hung with bells, and with a sword over it. The sword was the only one that could kill the serpent; it would regrow a new blade for every head, if it broke. He was to stuff the bells with cotton and then wound it in the tail. It would put its heads up, one at a time, and he should cut each one off.
He obeyed her and killed it. The animals of the island chased him, but he escaped.