The first thing to recognize is that the sun is an extremely bright source of light – much brighter than the moon. The second thing to recognize is that the atoms of nitrogen and oxygen in the atmosphere have an effect on the sunlight that passes through them.
There is a physical phenomenon called Rayleigh scattering that causes light to scatter when it passes through particles that have a diameter one-tenth that of the wavelength (color) of the light. Sunlight is made up of all different colors of light, but because of the elements in the atmosphere the color blue is scattered much more efficiently than the other colors.
So when you look at the sky on a clear day, you can see the sun as a bright disk. The blueness you see everywhere else is all of the atoms in the atmosphere scattering blue light toward you. (Because red light, yellow light, green light and the other colors aren’t scattered nearly as well, you see the sky as blue.)