The formation and evolution of the Solar System describes how the Solar System began, and how it will go on changing. 

About 4.6 billion years ago, there was a large cloud of gas nearby our area of space. All things with mass come together, or gravitate towards one another. This pulled all the gas towards the center. Eventually the pressure at the center raised the temperature so that hydrogen atoms fused together to make helium. This began the star we know as the Sun. 

The process by which solar systems are created is called the nebular theory. However, the origin of the planets is not the same as the origin of the Sun. Not only is the Sun very much larger, but its make-up is quite different from the planets.

The spin of the planets around the Sun, and each around its own axis, was first caused by the original gas cloud having different density in different places. The spin increased because of the contraction under gravity (conservation of energy). So did the flatness of the solar system's shape. As the collapse continued, conservation of angular momentum meant that the rotation accelerated. This largely prevents the gas from directly sticking onto the central core. The gas is forced to spread outwards near its equatorial plane, forming a disk, which in turn sticks onto the core.

Gravity caused the atoms in the Sun to become very close to each other. All this energy eventually made our Sun into a star. It gets its energy from changing its hydrogen into helium. That process is still in its early stages.

Because of the Sun's huge mass (99.86% of the whole mass of the Solar System), it has very strong gravity. The centrifugal force of the planets going round the Sun balances the gravitational pull of the Sun. The huge density at its core causes a fusion reaction which turns hydrogen into helium with the radiation of heat, light and other forms of electromagnetic radiation.

Rock and dust makes the terrestrial planets, their moons, asteroids and all other objects in the Solar System.  The gas giant planets also do have rocky or metallic centres. This is known from the data-gathering by satellites. This rocky material cannot come from the Sun, because the Sun is all hydrogen plus some helium.

The next issue is: if the Sun turns hydrogen into helium, where do all the other elements come from? There is only one possible answer: these higher elements came from earlier generations of stars. Huge supernovas which exploded billions of years ago in the neighbourhood of the young Solar System produced the higher elements. Huge stars run through their life cycle much faster than smaller stars. That is caused by the even higher pressures and temperatures inside them as compared with an average main sequence star like the Sun.

History of the idea  
The nebular hypothesis, as it was called, was first worked out in the 18th century. Three men worked on it:
Emanuel Swedenborg (1688–1772)
Immanuel Kant (1724–1804)
Pierre-Simon Laplace (1749–1827)

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.

Meanwhile, a similar model was developed independently and proposed in 1796 by Laplace. in his Exposition du systeme du monde. He thought that the Sun originally had an extended hot atmosphere throughout the volume of the Solar System. His theory had a contracting and cooling protosolar nebula. As this cooled and contracted, it flattened and spun more rapidly, throwing off (or shedding) a series of gaseous rings of material; and according to him, the planets condensed from this material. His model was similar to Kant's, except more detailed and on a smaller scale. Unfortunately, there was a problem with Laplace's version. The main problem was the angular momentum distribution between the Sun and planets. The planets have 99% of the angular momentum, and this fact could not be explained by the nebular model. It was quite a long time before this was understood.

The birth of the modern widely accepted theory of planetary formation – the solar nebular disk model (SNDM) – is due to the Soviet astronomer Victor Safronov. His book Evolution of the protoplanetary cloud and formation of the Earth and the planets, translated to English in 1972, had a big effect. In this book almost all major problems of the planetary formation process were formulated and some of them solved. Safronov's ideas were further developed. There are still quite a few aspects of the Solar System which need to be explained. 

Although it originally applied only to our own Solar System, the SNDM is now thought to be the usual way of star formation throughout the universe. As of August 2017, over 3000 extrasolar planets have been discovered in our galaxy.

Meteorites as clues to dates  

The nebular hypothesis says that the Solar System formed from the gravitational collapse of a fragment of a giant molecular cloud. The cloud was about 20 parsec (65 light years) across, while the fragments were roughly 1 parsec (three and a quarter light-years) across.

Because of the conservation of angular momentum, the nebula spun faster as it collapsed. As the material within the nebula condensed, the atoms within it began to collide with increasing frequency, converting their kinetic energy into heat. The center, where most of the mass collected, became increasingly hotter than the surrounding disc. Over about 100,000 years, a hot, dense protostar began at the centre. 

The oldest inclusions found in meteorites may be the first solid material to form in the presolar nebula. They are 4568.2 million years old. This is one definition of the age of the Solar System.

References 

Solar System