Juan Manuel, Prince of Villena
Andersen's tale is based on a 1335 story from the (or ), a medieval Spanish collection of fifty-one cautionary tales with various sources such as Aesop and other classical writers and Persian folktales, by Juan Manuel, Prince of Villena (1282–1348). Andersen did not know the Spanish original but read the tale in a German translation titled . In the source tale, a king is hoodwinked by weavers who claim to make a suit of clothes invisible to any man not the son of his presumed father; whereas Andersen altered the source tale to direct the focus on courtly pride and intellectual vanity rather than adulterous paternity.