Answer:
According to nebular hypothesis, the solar system was formed 4.5 billion years ago in solar nebula.
The solar nebula- a molecular cloud of dust and gases collapsed under its own gravity. In order to conserve momentum, this collapsed core started spinning while gathering more and more mass. The temperature and pressure rose. When sufficient temperature and pressure is achieved, nuclear fusion reaction kicks in. While the rest of the part formed proto-planetary disk.