Answer:
The solar system formed about 4.5 billion years ago from a dense interstellar gas and dust cloud. Then, the cloud collapsed, possibly due to the shockwave of a nearby exploding star called a supernova. When this dust cloud collapsed, it formed a solar nebula – a spinning, swirling disk of material.
The nebular hypothesis is the most widely accepted model of how our solar system came to be. According to the model, the solar nebula—a region in a giant cloud of gas and dust—began to collapse and contract under its gravity about 4.6 billion years ago. The center of the cloud became hotter and hotter. Then, the system started to rotate as it got more desirable and condensed. This was the beginning of the solar system's formation.
Over time, the cloud formed the Sun and a protoplanetary disk that gradually coalesced to form planets and other objects. The Sun was born out of a concentration of kinetic energy and heat at the center, while debris rotating the nebula collided to create the planets.