To understand why the sky looks blue and the sun looks yellow we need to know a bit about the properties of light.
White sunlight is made up of all colours, travelling to the Earth as waves.
Each colour has a different wavelength - violet, blue and green have shorter wavelengths than yellow, orange and red. The billions and billions of tiny molecules in the air are shaken as the light passes through them, and begin to vibrate at a similar frequency to the light waves. The speed of the molecules' vibration is closer to the frequency of blue light than red light. This means that as the molecules vibrate they scatter the blue light in all directions. The red light isn't scattered as much, and just keeps on going.