When the sun is overhead at noon, sunlight has to travel a shorter distance through the earth's atmosphere to reach us. During this short journey of sunlight through the atmosphere, only a small amount of the blue light is scattered from the white light, keeping most of the white colour intact within it.
However, at sunset or sunrise, the sun appears red because it is near the horizon, and sunlight has to travel a relatively longer distance through the earth's atmosphere to reach us. During this long journey, most of the blue colour is scattered from our line of sight. Therefore, the light reaching our eyes consists of the colour red of sunlight, which is of longer wavelength and is scattered the least.