The solar system formed approximately 4.6 billion years ago from the gravitational collapse of a region within a large molecular cloud, leading to the creation of the Sun and surrounding planetary bodies through accretion processes. This process involves complex interactions of physics, chemistry, and dynamics, resulting in the diverse array of planets, moons, asteroids, and comets observed today.