Hi Nick!
The core of the sun is hot becasue that is where the nuclear reaction happen that power the Sun. It is like haveing a huge number of hydrogen bombs going off all the time!
We know the temperature of the Suns surface by studying the light it gives off. The color of that light tells us how hot the surface is (hotter stars are bluer, cooler ones redder). Finding out about the insides takes more work. We canfigure it out using modeling of the Sun, calculating what it would be needed to match the surface temperature, mass, size, and age. That tells us what it is like inside. More recently we have been able to check the models by studying the vibrations of the Sun. This is called helioseismology. Those measurments pretty much back up the models.
Cheers,
Terry