Why is our Sun hotter than UY Scuti? As Wikipedia says the surface temperature of UY Scuti is 3,365 K and the sun is 5,778 K 

Why is the Sun hotter than a supergiant star like UY Scuti?
UY Scuti is a red supergiant star. 

When stars start to run out of hydrogen fuel, their cores start to collapse, causing the core of the star to heat up, and heavier elements start to be used as fuel. This means that the core of the star is hotter and producing more energy.

The effect on the outer layers of the star is to cause them to expand, and as things expand, they cool. The outer visible layer of the star cools (to about 3500K) 

So the energy output of the star increases, but the temperature of the outer layer decreases. As you might expect this leaves the star unstable, and UY Scuti undergoes semi-regular variations in brightness.