Earth formed over 4.5 billion years ago from a swirling cloud of gas and dust squished together by gravity. That same cloud gave rise to our entire solar system, including our star, the sun.