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?
Astronomy Stack Exchange is a question and answer site for astronomers and astrophysicists. It only takes a minute to sign up.Sign up to join this community
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.