Our Solar System is part of the Milky Way Galaxy that contains billions of other stars.
Our Sun is thought to be a third generation star created from the materials from two previous generations of stars which had reached the end of their lives and exploded sending their material out into the universe.
About 4.6 billion years ago the solar system began to form within a molecular cloud, a concentration of interstellar dust and hydrogen gas. The cloud contracted under its own gravity and our proto-Sun formed in the hot dense centre. The remainder of the cloud formed a swirling disk called the solar nebula. It was within this solar nebula that beginnings of planets were born as dust and ice particles came together in a process called “accretion”. These planetesimals continued to grow, their gravity coming to influence each other’s motions causing more collisions and accretion and so creating proto-planets. This continued until there were only four large bodies in the inner solar system, Mercury, Venus, Earth and Mars. In the cold outer nebula much larger proto-planets formed, Jupiter, Saturn, Uranus, and Neptune.
Our Moon was formed shortly after the formation of the Earth; the Earth was hit by an object half its size which disintegrated along with the outer layers of the Earth. The debris from this formed a ring around the Earth which accreted, clumped together, to form the Moon.