There are 156 tales in this collection, and you could make a case that each one has its own setting: in some stories, flowers can talk, while in others, historical figures pop in for a chat. So since we can't make one overall statement that applies to the setting of every single tale, we'll point out some general patterns and supply you with a handy-dandy roadmap for thinking about the role of setting throughout Andersen's collection. Since we're, like, totally sure that's what you'll be doing in your spare time.
So, a lot of Andersen's stories are set in Denmark: either the Denmark he knew and loved during his lifetime (1805-1875) or the past. Most of the time you can pretty much just assume that if it doesn't say the story's set somewhere "exotic," like China or Egypt, or obviously fairy-tale-like, it probably takes place in Denmark.
For example, in "Little Ida's Flowers," we see a little girl named Ida talking to a student about the reason her flowers wilt and die. The student explains that the flowers all go to the park near the king's summer castle to attend a grand ball. This could, in theory, happen anywhere; a lot of old kings in European countries used to have shmancy summer homes. But a few pages into the story, we hear about a particular Danish custom of making switches out of plants, and then we see the switch on little Ida's table. So the setting is Denmark, even though it's not super-obvious and Andersen doesn't write in neon flashing letters, "Hey guys this story is set in Denmark, just FYI. Okay thnx bye."
Other stories practically do advertise their Danishness in neon flashing letters. "The Magic Galoshes" begins like this: "In one of the houses on East Street, near the King's New Square, which is in the very center of Copenhagen, a big party was being held" (10.1). Bam: we're in Copenhagen. In the very center of it, in fact.
And, we also realize we're in Andersen's time because one of the topics of conversation is a recent publication by Oersted, a contemporary of Andersen's. But then there's time travel to a previous era in Denmark's history, when King Hans ruled (late 1400s-early 1500s). According to the time-traveler, the past is muddy and poorly lit. Add "stinky" to that list and it sounds about right to us.
Tales like "Holger the Dane" and "Godfather's Picture Book" give us a whirlwind tour of Danish history, illuminating some of its standout moments, from beloved rulers to total bloodbaths. If you feel like reading these tales with a Danish history book open beside you, more power to you. But one truly awesome thing about these tales is that Andersen is a skillful enough writer to give you a sense of the historical setting without getting so bogged down with Cool History Facts For People Who Like That Sorta Thing that you can't follow what's going on in this story. For the most part, these tales Denmarky-ness just provides a rich background for Andersen's plotlines, rather than serving as a distracting lecture that takes you out of his stories.
Andersen was fascinated by travel to faraway locations, and it shows in his stories. "The Bronze Pig" takes place in Florence, Italy, and "The Pact of Friendship" is set in a handful of small villages in Greece. "The Nightingale" is set in China, but apart from there being an emperor involved, we can't say that the country is very, um… truthfully represented.
In "The Garden of Eden," the four winds all hang out and talk about their travels. The north wind visited the Arctic Ocean and messed around with some Russian whalers, the west wind kicked around uninhabited parts of America, the south wind blew a bunch of sand around in Africa, and the east wind chilled (har har, get it?) in China. Yes, there were inappropriate racial slurs included in these descriptions. No, we won't repeat them.
So, on to the truly important stuff: are references to foreign lands just a handy way for Andersen to add some spice to his stories? Could be. But you have to imagine, if you were a Danish reader in the mid-1800s, stuck in a small, snowy nation long before the internet was ever invented, you'd want some way to read about the rest of the world… even if it is just one guy's opinion of the rest of the world. Cuz only scientific facts vetted by super smart Ph.D.-type people around the world are posted to the web, right?
A bunch of Andersen's tales take place not in the world as we know it, but in fantasy-land or fairy tale-land. We'll pick an example at random—oh, hm, how about the very first tale in the collection, "The Tinderbox"?
A soldier marching down the road meets a witch, and descends into a hollow tree trunk in order to retrieve a tinderbox for her. Inside the trunk are three rooms filled with chests of gold guarded by dogs with humungous eyes. Once the soldier takes the tinderbox as his own, the dogs will magically appear and fulfill his every wish. Yeah, we're not in Kansas anymore. But there are still castles and royalty and silver coins, so even Andersen's excursions into fantasy have a foot in the real world.
Similarly, in "The Traveling Companion," we see some real-world stuff—poor Johannes has to bury his father, then sleeps in a church, and generally wanders around for a while—mixed in with some fantasy-land stuff. Check out the crash-space of this evil troll who's enchanted the princess:
In the middle of the hall stood a throne, which rested on the skeletons of four horses; their bridles were made of red spiders. The seat of the throne itself was milk-white glass, and the pillows were little black mice who were biting each other's tails. Above it was a canopy made of pink spider webs, decorated with little green flies that shone like precious stones. On the throne sat an old troll with a crown on his ugly head and a scepter in his hand… Now the music began. Big black grasshoppers played on mouth organs. Owls beat themselves on their stomachs: they were the drums. It was a funny concert. Small black trolls with jack-o'-lanterns in their hats were dancing. (7.70)
So, yeah, we get a mix of magical make-believe and real-world flavor in some of Andersen's tales. And that's not a super far cry from the world we live in, because even though we don't have trolls or talking paper running around this universe, trippy nature stuff happens all the time. Like this shark cloud eating other clouds.
If you really want to understand why Andersen wrote the things he did, it's helpful to have a sense of his life story, the times he lived in, and how his work was received.
Andersen was born in 1805 to poor parents in Odense, Denmark. He became theater-obsessed, and went to Copenhagen when he was fourteen to pursue his dreams in the big city. He was creative but not polished, so luckily for him some rich patrons helped fund his education.
He finally hit his stride in the 1830s, when he started publishing a bunch of his work, including poetry, plays, novels, and short stories, and traveling to various parts of Europe. Nobles from other countries welcomed him into their homes. Then, Denmark finally came around and recognized him as a national treasure. Which is a good thing, because as we mentioned, the dude sure spent a lotta words talking up his homeland. He continued to be very prolific, until a few years before his death in 1875.
So, how did Andersen's life context inform his tales? For one thing, Andersen felt that he was entitled to fame and glory as an artist. And in his stories, we see characters who are convinced that they have a destiny to fulfill. Johannes from "The Traveling Companion" wants to marry the princess. The protagonist of "The Little Mermaid" is dead-set on marrying the prince in order to gain a human soul. And so on.
Furthermore, partly because of his dedication to his work and partly because some scholars speculate he was into guys as well as girls in 1800s Denmark, Andersen's love life was practically non-existent. He pined after women, and maybe some men, who never returned his affection. In his stories, we see characters suffering from similarly unrequited love—e.g., "The Little Mermaid," "Ib and Little Christina," and "The Pepperman's Nightcap."
Andersen was also really into Christianity, like most of his Danish compatriots at the time. This devoutness also manifests in his stories, including "The Snow Queen," "The Red Shoes," and "The World's Most Beautiful Rose." Check out our Allusions section for more examples of the metric crap-ton of religious references that crop up in his tales.
To zoom out a little, it seems like Andersen was a sad, misunderstood artist who wrote about other sad, misunderstood artists. Like all of us, he wanted to be cherished and loved. And so do a lot of his characters, whether they're mer-people or flowers or ordinary boys and girls.
Wanna learn more? Don't just settle for Wikipedia; check out Hans Christian Andersen: The Misunderstood Storyteller by Jack Zipes, a folklorist who's done a bunch of research on Andersen's life and how it relates to his fairy tales. The Hans Christian Andersen Center's website also has a bunch of cool resources on him, including an in-depth biography, that you can explore. Enjoy!