While there are certainly plenty of folkloric and mythical elements in Studio Ghibli's 1986 anime film Castle in the Sky (aka Laputa), in this article I'm going to focus on just one, the titular castle itself: the floating island of Laputa.
The most obvious source of the "castle," or island, of Laputa is Jonathan Swift's 1726 novel Gulliver's Travels. Swift's hero Lemuel Gulliver is on a ship that is attacked by pirates and he ends up marooned on a rocky island. Fortunately, Gulliver is rescued by the citizens of the floating (in the air) island of Laputa.
The island is circular, with lower levels of rock and upper levels of forested hills and catchbasins for rainwater. The core of the island is a giant lodestone (natural magnet) that keeps Laputa afloat and enables engineers to steer it and move it closer to and farther from the surface. The inhabitants of this island are scholars, so focused on their studies that they need attendants to make sure they don't walk into things. Swift wrote Gulliver's Travels as a political satire and the Laputa chapters target the military, government bureaucracy, and especially the Royal Society and its devotion to pure science without practical applications.
The Laputa of Castle in the Sky is also a floating island, held aloft by advanced technology centered around a stone with anti-gravity properties. When the main characters of the movie land on the island, they find it devoid of human life, but full of signs of a technologically-focused society that died out because it was too absorbed in science. While the Laputa created by director/producer/writer Hayao Miyazaki is not as overtly satirical as Swift's island, it does seem to hint at similar themes--most notably the dangerously close focus on science and technology. Miyazaki is known to be a Luddite, so it's no surprise to find such a theme in his work.
There are older antecedents for Laputa, and one of those is a legend that has its best-known source in the works of Greek philosopher Plato. Atlantis was first described in two of Plato's philosophical works of the 4th century BC, Critias and Timaeus, but is supposed to be an even older legend, passed on to the Greeks from the Egyptians, and the legend has been re-told and elaborated since that time. While Atlantis was never described as a floating island, it is similar to Swift's Laputa in many ways, including the circular arrangement of its capital city and its emphasis on advanced technology. Atlantis was a utopia, but most accounts describe it as having become corrupt--perhaps through too much reliance on advanced technology. After a failed attempt to conquer Athens, Atlantis was swallowed by the sea during a single night of earthquakes.
Ghibli's Laputa has as much in common with Atlantis as it does with Swift's Laputa. Though Ghibli's Laputa didn't tumble into the sea, it did crumble apart and its remnants soared off into the heavens. The vanished inhabitants of Laputa were much like the Atlanteans: they had a utopian society that fell apart when they began to rely too much on technology.
The floating island motif has an even longer history than Atlantis and is found in cultures all over the world, from South America to Ireland to China. Mythical floating islands are frequently believed to have mystical properties like growing special herbs that cure all diseases or the ability to hide a person from their enemies. I haven't yet encountered islands that float in the air as Swift's and Ghibli's Laputa does, but it's not a huge leap from an island floating on a lake or ocean to one that floats in the sky. At any rate, an island that floats is a rare and special place.
While Atlantis ultimately sank beneath the waves and vanished utterly, the Laputa in Castle in the Sky slipped its ties to the Earth and floated off into the heavens, leaving the possibility that, however unlikely, it might still be out there somewhere, waiting to be found when humankind has developed far enough to reach it. And that is, ultimately, not a pessimistic view of humanity as Swift's satire was, but a very optimistic--if somewhat melancholy--view.
If you're interested in reading more about the ideas I've brought up here, there are some great books out there. First, of course, is Gulliver's Travels itself. For non-fiction works, I suggest browsing The Dictionary of Imaginary Places (edited by Alberto Manguel and Gianni Guadalupi and published by Macmillan), which has detailed entries on both Swift's Laputa and Atlantis. The Atlas of Legendary Lands by Judyth A. McLeod (published by Pier 9) also has a section on Atlantis, as well as a chapter on floating islands. Finally, a good book on islands that appear and disappear from maps (though none of them are floating, per se) is Phantom Islands of the Atlantic by Donald S. Johnson (published by Goose Lane).