The Shadow (Danish: Skyggen) is a fairy tale by Danish poet and author Hans Christian Andersen, an exemplary story in Andersen’s darker fairy tales. The tale was first published in 1847. Is about a goodhearted writer who loses his shadow. Years later it turns up on his doorstep, having seen the world and decided being goodhearted is for sissies. In the months that follow the two live together—the writer being good and becoming poorer and unhealthier; and the shadow becoming richer and fatter. Finally, the shadow offers the writer a trip to a health resort—all-expenses paid—so long as the writer agrees to switch places and become his shadow. At the resort they meet a princess; the shadow woos her and hatches a plot to take the writer’s place permanently.
Wow, how will the writer get out of this one?
Spoiler: by being executed. When he realizes the shadow’s plan the writer tries to stop him; only to be arrested while the shadow marries the princess. He disappears and—as an afterthought, we’re later told he was executed. The good man dies and the evil doppelgänger gets to marry royalty. Source
The ending is especially bleak for a fairy tale, as Andersen suggests that it is not always good that triumphs, and that evil does indeed have a powerful grip over the good and just. Some critics have suggested that Andersen wrote the story as a form of indirect revenge against Edvard Collin, for whom he felt an unrequited love.