God set them in the firmament of the heavens to give light on the earth. (Genesis 1:17)
According to God’s Word, bodies out in space, like the sun, moon, and stars, were created on Day Four of the Creation Week. This is found in Genesis 1:14–19.
God called the sun, the greater light—and it dominates the day. God called the moon, the lesser light—and it dominates the night. Genesis 1:16 says, “He [God] made the stars also.” The word that we translate “stars” also includes planets, comets, asteroids, and so on.
Many people incorrectly guess that the solar system and the planets formed from a spinning and collapsing nebula (a cloud of gas and dust) with the sun at the center and the planets, asteroids, and so on at various distances. This has never been observed or repeated; it is just a story to try to explain the universe without God.
God, who knows all things and who was there at the beginning, revealed in His Word that He was responsible for creating the sun, moon, and stars (including the planets). Be careful about the stories that man tells, especially when they disagree with God’s Word. “It is better to trust in the LORD than to put confidence in man” (Psalm 118:8).