The sun is the color it is because its surface is 5500 Kelvin, which we have defined as white. The sun is cooler than most visible stars, so it can be called yellow by comparison.
The sun appears slightly yellow because the atmosphere scatters blue light more than the rest. The result is the sky looks blue, the sun is slightly yellowish, and the cumulative light (both directly from the sun and diffuse light from the sky) is white. Outside the atmosphere, our sun appears proper white.