Earth's primary sources of heat are from radioactive decay, frictional heating and Earth's formation. Although Earth was created around 4.5 billion years ago, there is still leftover heat from its formation.
The Earth's natural radioactive elements like uranium decay, cause much heat production. The heavier core material sinking to Earth's center also causes heat production via frictional process. The planet has cooled down tremendously since its formation out of a gas and dust cloud in space. But, its cooling process is delayed due to the continuous heat production. Slow convection and conductive heat transport inside Earth and on its surface also delay it.
Earth also receives heat energy from the sun. But, unlike Earth's heat that is instrumental in mountain formation, the sun's heat tears a mountain down via erosion.