Earth's internal energy drives the movement of tectonic plates, produces moutains, volcanoes and earthquakes. About 5 billion years ago our solar system began as a swirling nebula of dust. Most of the material in this nebula was hydrogen and helium, with much less of all the other 90 elements. All of the more complex atoms were created in earlier stars that exploded in the previous 10 billion years. After most of the matter concentrated into what would be the Sun, the enormous amount of pressure caused by the Sun's mass and gravitational field initiated nuclear fusion .
Fusion is the fusing together of hydrogen to form helium.
During this process enormous amounts of energy are released. The Sun is a continuous nuclear fusion reaction that has been occuring continuously for the last 4.6 billion years. Planetesimals are small bodies of matter that formed in numerous orbits around the Sun. With time the larger bodies collided and captured smaller pieces. From these collisions the planets formed.