Anaximander is the Greek philosopher credited with originating the idea that the sun, moon and stars are set on celestial spheres. At least, he wImage via Wikipediaas the first to write about it. There's a good chance that the idea was pretty thoroughly discussed in Greek philosophy circles and he is the only one to have his writings about it survive.
The idea he puts forward is that the earth is surrounded by vast nested wheels whose rims were hollow and filled with fire. Holes in the rims let through light that we call the sun, moon and stars. He thought that the stars were closest, then the moon and finally the sun.
The conception of the heavens as being made up of celestial spheres has undergone a lot of modification since Anaximander first wrote about it.
Plato stuck his oar in the 4th century BC saying that the heavens were a vast sphere containing the stars and the planets were set in rings rather than wheel rims. Ptolemy refined this idea and made it much more mathematically rigorous.
From what I can see, it was in the Middle Ages that the idea of the celestial spheres underwent a lot of modification. Probably because maths was being popularised (to an extent) at the same time. The changed idea had an empyrean realm outside that holding the stars which was the abode of God and all the elect (those saved by God).
Interestingly, each of the lower spheres had its own subordinate celestial being that kept them moving - angels. The idea was that the spheres were made of a liquid that was solid (in the sense of continuous) rather than hard.
The growing skill with observation and telescopes kept catching out the models that were being proposed as it kept showing novel phenomena that could not be accounted for.
Maths was key to all this. Especially for those wise men who wanted to operate on the spheres and communicate with the spirits that dwelt within them. Trithemius' great work Steganographia is essentially a book of really hard maths that wise men were supposed to use to understand what was happening above their heads.