Why stars have different colors?

Stars have different colors in white, blue, yellow, orange, and red. The color indicates the star’s temperature in its photosphere, the layer where the star emits most of its visible light.

Meaning blue is still hot but cooler than red?

It is the other way around. The color of a star comes from its temperature. The coolest stars appear red, while the hottest stars are blue. For a star, the only thing that defines the temperature of a star is its mass.

Yellow is hotter than blue correct?

Blue is hotter according to searches.