To add to the answer above, there is another way of looking at the didactic value of Andersen's story. The little mermaid yearns not only for the prince's love but also for a soul, and her love for the prince, too, appears quite exalted.
In short, the little mermaid is of a deeply spiritual nature, whereas no-one else in the underwater world appears to be. They might have an enjoyable and long life, but nothing comes of it in the end. The little mermaid's longing for a more spiritual existence, for an immortal soul, is presented quite in a positive light, I think. She could so easily have been contented with her own beauty and charm and singing voice, and all the material richness of her life under the sea, but she aims for something higher, both literally and metaphorically. True, she enlists the help of a witch and suffers terribly for her goals, and appears to be finally condemned to death, but at the last moment, she finds redemption. This could be seen as analogous to the questing, suffering and final redemption of the religious life; and on this reading the ending is perfectly fitting. In addition, if the story posits the existence of a underwater realm, there is nothing so very out of the way in the portrayal of an ethereal realm also, at the end.
Therefore, in my view the didactic element in this story is that it suggests that one should seek spiritual fulfillment and not be merely content with material riches. In my view, the world under the sea is shown to be rather smug and self-complacent, which ultimately cannot satisfy someone of a purer and profounder nature like the little mermaid.
Hans Christian Andersen’s fable The Little Mermaid could be considered to be didactic in a number of ways. Putting aside the entirely contrived resolution that ensured that what should have been a tragedy – and pretty much was anyway – ended relatively happily, with the young mermaid’s immortal soul granted courtesy of the “daughters of the air,” Andersen’s story could be considered a parable about the importance of recognizing one’s proper place in the world and the dangers of excessive ambition. The mermaid of the title, youngest of six daughters of the Sea King, is finally, upon her fifteenth birthday, allowed to go to the surface of the sea and observe mankind and the natural wonders on land. As the privileged daughter of a king, she has wanted for nothing during her life, and has, as with her sisters, spends her days playing among the creatures of the sea. All of the king’s daughters are anxious about exploring the world beyond the sea, but the youngest is the only one who will violate the agreement described as follows:
“. . .each promised to tell the others what she saw on her first visit, and what she thought the most beautiful; for their grandmother could not tell them enough; there were so many things on which they wanted information.”
Whereas each of her older siblings manages to explore man’s world without incident, the youngest mermaid becomes hopelessly entangled physically and emotionally with that alternative universe, which precipitates her downfall. Having spied and fallen instantly in love with a handsome prince, the little mermaid quickly loses any sense of perspective. She saves the prince from drowning after his ship is wrecked, but can’t pursue the relationship because of the very clear distinction between their relative species. As described by Andersen, the mermaid can only gaze landward longingly as humans come to the aid of the prince she has just saved:
“. . .the mermaid saw that the prince came to life again, and smiled upon those who stood round him. But to her he sent no smile; he knew not that she had saved him. This made her very unhappy, and when he was led away into the great building, she dived down sorrowfully into the water, and returned to her father’s castle. She had always been silent and thoughtful, and now she was more so than ever. Her sisters asked her what she had seen during her first visit to the surface of the water; but she would tell them nothing.”
And, now comes the stalking element of Andersen’s fable: “Now that she knew where he lived, she spent many an evening and many a night on the water near the palace.” The little mermaid has become obsessed with the prince and will do anything to be with him. She is instructed that the human soul is immortal whereas mermaids, while they live for hundreds of years, die and simply become foam, prompting the following exchange with her grandmother:
“Why have not we an immortal soul?” asked the little mermaid mournfully; “I would give gladly all the hundreds of years that I have to live, to be a human being only for one day, and to have the hope of knowing the happiness of that glorious world above the stars.” “You must not think of that,” said the old woman; “we feel ourselves to be much happier and much better off than human beings.”
Andersen’s fable appears intended to educate young readers about the importance of accepting one’s place in the world and about the dangers of aspiring to be something we’re not. The little mermaid’s agreement with the witch to sacrifice her beautiful voice in exchange for human physical attributes and the potential for an immortal soul is a classic case of what, in another context, could be considered “the Midas syndrome.” The mythological figure of King Midas precipitates his own downfall through his unbridled greed. Not content to accept the riches he already possesses, he arranges to be able to turn anything he wants into gold. His demise is a direct consequence of his greed. But for the preposterous intervention of the “daughters of the air,” such would have been the fate of the little mermaid. Her gambit has failed, and she is presumably doomed to an early death without a soul. Perhaps, recognizing that his audience was primarily children, Andersen sought to spare young minds the tragedy that should have befallen the mermaid. The message about unbridled ambition and living beyond one’s position in life, and about abiding by arrangements regarding disclosure of one's observations of humanity, however, survived his ending.
Regarding parallels to or contrasts with George McDonald's The Light Princess, the lessons to be learned are even more arcane than is the case with Andersen's story. A somewhat heartless king regularly chastises the queen for her "failure" to become pregnant: "Why don't you have any daughters, at least?" said he. "I don't say sons; that might be too much to expect." When. finally, he gets his wish and a daughter is born to him and his wife, the baby is cursed by the evil aunt to be forever "light," causing her to both be resistant to gravity and to seemingly be condemned to be light of head (i.e., not very bright). That the daughter will eventually marry the prince, who helps her discover gravity, and that the aunt will drown due to her own vicious machinations still leaves us pondering the meaning of McDonald's story. The princess is destined to remain childlike in demeanor, yet regains an ability to walk like others upon the earth. If McDonald had intended his story to be a parable regarding the king's disposition, he may have missed his target, as the princess was an innocent victim of her aunt's vindictive nature. No clear parallel with the little mermaid seems to exist.