how did the earth moon and sun form
Earth found its path as third planet from the sun. In the early days rocky pile-ups were still common, leaving craters on the surface of all of the planets. One of these collisions, about 4.5bn years ago, is thought to have very nearly destroyed the Earth, and was probably responsible for our moon. A large planetesimal, about the size of Mars, gave Earth a glancing blow, chucking a chunk of Earth's crust out into space.
Earth formed around 4.54 billion years ago by accretion from the solar nebula. Volcanic outgassing probably created the primordial atmosphere and then the ocean; but the atmosphere contained almost no oxygen and so would have been toxic to most modern life including humans.