Swedenborg first had the idea, and Kant worked it up into a proper theory. In 1755 Kant published his "Universal natural history and theory of the heavens" (in German, of course). He argued that gaseous clouds, nebulae, slowly rotate, gradually collapse and flatten due to gravity. They eventually form stars and planets.