The Earth, like an onion, has layers. The layers are the crust, the mantle, and the core. The crust is the part we stand on. It is made mostly of rocks and sediment. Then, comes the mantle, whihc is under the crust. The mantle is a mix of magma and semi-solid material. Then, comes the core, which is split into two parts: the outer core and the inner core. The outer core is hot liquid rock and the inner core is a solid ball of iron and nickel.
But, how can the inner core be as hot as the surface of the Sun? It is because of the intense pressure of the other layers. The other layers, the crust, mantle, and the outer core are above the inner core. These layers are super heavy, which means that it applies pressure to the inner core. That intense pressure of the layers above it creates heat. That heat is what makes the core as hot as the Sun! That heat also makes the outer core and the mantle hot.