The king in the mountain is one of the great archetypal myths: a king who presided over a past golden age is said to have retreated with his warriors into a mountain cave where he waits, sleeping but not dead, one day to return. It is often associated with King Arthur, Charlemagne, Frederick Barbarossa, or Frederick II.
Juleigh Howard-Hobson provides a chronology of its various appearances and iterations in an essay at Counter-Currents:
The idea of a king, or hero, sleeping in a cave or hollow mountain is an old one in Northern Europe and the British Isles. So old, in fact, that the sleeping king motif is “one of the few myths of the British Celts to be put on record by a classical author.”
The classical author was Plutarch. Plutarch’s work “The Silence of Oracles” quotes a certain government agent, Demetrius, who in 82 CE wrote down various tales and miscellanies told to him by the people he encountered while he was in Britain. Adhering to the then-approved custom of endowing every god/hero, regardless of origin or existing name, with Classical nomenclature, the story, as written by Demetrius, would seem to be a Greek one. It is actually an extremely early version of the European Sleeping King myth.
There is, they said, an island where Cronus is imprisoned with Briareus keeping guard over him as he sleeps; for, as they put it, sleep is the bond forged for Cronus. They add that around him are many deities, his henchmen and attendants.
In a later work, in a section referring to Britain and various outlying British Isles, Plutarch himself writes:
The natives have a story that in one of these Cronus has been confined by Zeus, but that he, having a son for a gaoler, is left sovereign lord of those islands and of the sea, which they call the Gulf of Cronus. . . . Cronus himself sleeps within a deep cave, resting on rock which looks like gold, this sleep being devised for him by Zeus in place of chains. Birds fly in at the topmost rock, and bear him ambrosia.
This is the elemental hero sleeping in the cave story, with very early references to both the treasure (the rock that looks like gold) and the ravens that often accompany such heroes as they wait, in their deep hidden places, to come back.
Parallel stories, with kings/gods/heroes asleep in caves/hills/mountains appear all through out Northern Europe. As a matter of fact, this basic story is so common that it is now identified as folktale type 766 in the Antti Aarne and Stith Thompson (AT) folktale classification system–considered the standard reference catalogue of international folk stories. The story of the sleeping hero, or the hidden king, is as firmly embedded in the folksoul of the European people as are the mountains and caves themselves.
Switzerland, Sweden, Norway, Denmark, Germany, Austria, The Czech Republic (then Bohemia), Sicily, England, Wales, Ireland, Scotland . . . all hold, deep in secret places within their hills, a sleeper or sleepers, who will waken at the time when the folk are in their greatest need of a hero.
Professor D.L. Ashliman has catalogued a number of related myths in his bibliography of folktexts at the University of Pittsburgh. The most famous account comes from the Deutsche Sagen by the Brothers Grimm:
Many legends are in circulation dealing with [Emperor Frederick Barbarossa]. They say that he is not dead, but that he shall live until the Day of Judgment, and also that no legitimate emperor shall rise up after him. Until that time he will remain hidden in Kyffhäuser Mountain. When he appears he will hang his shield on a dead tree, and leaves will sprout from the tree, and then better times will be at hand. From time to time he speaks to those who find their way into the mountain, and from time to time he makes appearances outside the mountain. Generally he just sits there on a bench at a round stone table, asleep with his head in his hands. He constantly nods his head and blinks his eyes. His beard has grown very long, according to some it has grown through the stone table, according to others it has grown around the table. They say that it must grow around the circumference three times before he awakens. At the present time it has grown around the table twice.
In the year 1669 a peasant from the village of Reblingen who was hauling grain to Nordhausen was taken into the mountain by a little dwarf. He was told to empty out his grain and allowed to fill his sacks with gold in its place. He saw the emperor sitting there entirely motionless.
In addition, a dwarf led a shepherd into the mountain who had once played a tune on his flute that had pleased the emperor. The emperor stood up and asked: “Are ravens still flying around the mountain?” When the shepherd answered “yes,” the Kaiser responded: “Then I must sleep for another hundred years.”
A monument to Barbarossa was erected in the Kyffhäuser Mountain range in the 1890s. It depicts him waking. Above him stands an equestrian statue of Emperor Wilhelm I, tying the legend to German unification under the Prussian monarchy.