Apparently common sense is not a requirement to be a ruler in Andersen's tales. (Or in real life, we want to say. But you know, there are some good ones…)
Take, for instance, the emperor in "The Emperor's New Clothes." The guy is a total mall freak: "He had an outfit for every hour of the day" (9.1). All he ever does is buy and wear new clothing. It's not like he has an empire or anything to rule, right? He's also gullible. When some tricksters come to town claiming to be able to weave "the most marvelous cloth" that is "invisible to anyone who was unfit for his office or unforgivably stupid" (9.2), he believes him. Because cloth that is invisible, not just cloth that makes you invisible, is totally a thing.
Vanity and gullibility turn out to be a bad combo. The emperor buys into this whole magically-judgey-cloth hustle and wears an outfit of it around town. Yep, he's living that nightmare where he's wandering around naked but hasn't quite realized it yet. Then he does, and so does the whole town, but he continues on his walk.
When you're the emperor, a little case of No Clothes isn't about to stop you from taking a stroll before the common folk. The emperor's embarrassed, for sure. But given that he can kill or throw in jail anyone who looks at him funny, this embarrassment—and, likely, a life of missing out on really, really obvious stuff that everyone else sees—are his only consequences. Wait, that's actually pretty bad.
Another of our foolish rulers can be found in "The Nightingale." In this tale, an emperor hears about a nightingale that sings the most beautiful songs anyone's ever heard, so he orders the bird brought to him. The bird is happy to sing for him, but the emperor stops caring about it once another emperor dude sends him a mechanical bird that makes technically perfect music.
Of course, the mechanical bird breaks, as machines are apt to do, and the emperor realizes that he's made a mistake in sending away the real nightingale. Cuz, you know, vinyl has, like, such a fuller, purer sound than that newfangled .mp3 crap.
Luckily for this emperor, the nightingale returns to sing to him while he's on his deathbed, and his singing actually heals the emperor. So has the emperor learned his lesson? Not really. He tells the nightingale: "You must come always… I shall only ask you to sing when you want to" (25.73). Um, dude, way to miss the point: the best art is created when the artist is singing from his own heart, not when he's ordered to.
The fact that these emperors are so consistently stupid, vain, and self-centered kinda makes us understand what those Founding Fathers of the ole U.S. of A. were after with that whole democracy bit.