dispersion
Shine a beam of ordinary white light through a triangular glass prism and it fans out on the far side into a band of colours, red, orange, yellow, green, blue, and violet, the whole rainbow. White light was secretly a mixture of all these colours all along, and the prism sorts them out. This spreading of light into its colours is called dispersion. It answers the question: why does a prism (or a raindrop) split white light into a rainbow instead of just bending it as one beam?
The key fact is that a material's index of refraction is not exactly the same for every colour, it is slightly larger for shorter-wavelength light (violet and blue) than for longer-wavelength light (red). Since Snell's law bends light by an amount that depends on n, violet light bends a little more than red light at each surface. So when white light enters and exits a prism, each colour follows a slightly different path and the colours fan apart. The general rule for ordinary transparent materials, called normal dispersion, is that n decreases as wavelength increases, so blue bends most and red bends least.
Dispersion is why rainbows exist: raindrops act as tiny prisms, refracting and internally reflecting sunlight so each colour emerges at its own angle. It is also a nuisance engineers must fight, in a simple lens it causes chromatic aberration, coloured fringes around images, which good camera lenses correct by combining different glasses. An honest caveat: dispersion is a property of the material, not of light on its own. In vacuum every colour travels at exactly the same speed c, so there is no dispersion and no rainbow without matter to do the splitting.
A prism spreads sunlight into a spectrum because crown glass has n = 1.514 for red light but n = 1.528 for violet. The tiny difference is enough that after two refractions the colours emerge a few degrees apart, wide enough for the eye to see the fan of colours.
n depends slightly on colour, so violet bends more than red and white light fans apart.
Dispersion needs a material, in vacuum all colours travel at the same speed c and never separate. The prism does not add colour, it merely reveals the colours white light already contains.