The universe began around 13 billion years ago, according to the Big Bang theory . This start comes from an incredibly hot , dense state , an explosion in which the various chemical elements were produced during the first few minutes after this event. From this explosion the universe begins a process of expansion which expands as it goes through several transitions, particularly those that separated the physical forces and gave rise to various particles, mostly protons, neutrons, electrons and photons(radiation). These particles together, forming core and finally atoms.
The first atoms to form was the helium(He), deuterium(D) and lithium which have arisen through fusion of protons and electrons . Yet this time all matter was ionized, protons and electrons were separated and in thermal equilibrium with radiation. However, when the temperature fell to a few thousand degrees, electrons began to combine with protons to form neutral atoms, and these have greater difficulty in interacting with photons and ends the era of radiation began with the Big Bang , giving beginning the era of matter.
In the era of matter to expand, helium and hydrogen cooled and condensed into stars and galaxies. The initial cooling is radiation remains as the universe expands, coming now at a temperature of about -270 degrees centigrade. The process of star formation started around 200 million years and galaxies about 500 million years after the Big Bang.
The Solar System formed only around 5 billion years ago by gravitational collapse of a molecular cloud that gave rise to several stars among which the Sun and the Earth formed around 4.5 billion years ago.