The Earth was made about 4.5 billion years ago from a cloud of gas and dust.
In the beginning, much of the Earth was molten because of frequent collisions with other bodies which led to extreme volcanism. A “giant impact” collision with a planet-sized body is thought to have been responsible for forming the Moon. Over time, the Earth cooled, causing the formation of a solid crust, and allowing liquid water to exist on the surface.
If you have time you should watch ‘Cosmos: A Space Time Odyssey’ – it is an amazing programme. Check it out on the link below,