Sun is the major source of electromagnetic radiation. Then if the source is the same, how are different EM waves with differing wavelengths produced?
Monochromatic light is only produced if the charge motion in a source has a strictly periodic motion with a fixed period. Sun has many different charges moving aperiodically, so it produces the whole spectrum of frequencies. You can imagine it as a huge set of different sources with different frequencies.