A massive star exploded in a supernova creating a nebula, or cloud of gases and dust in space.
Because this cloud was a remnant of a massive star, it was enriched with some heavier elements such as iron-.
5 billion years ago this nebula began shrinking under the pull of gravity. As it shrank, it rotated, or spun, faster and faster. Material towards the center compressed due to gravity and grew hotter and hotter until nuclear fusion began, creating a new star, our Sun.
Around the Sun swirled a disk of material, which grew white-hot from the compressive forces. This disk of leftover material, called a protoplanetary disk, eventually became the Earth and other planets.
The Earth is Born!!!! For a long time the surface of the Earth was completely molten with no solid surface.
The Earth was stuck by a planet-sized object that scientists call Thea. Thea struck the Earth with a glancing blow. The impact likely flash melted the surface of the Earth and destroyed Thea, spraying debris around the Earth. This debris material eventually collected and formed into the Moon over about a year.