What causes the different colors in the color spectrum?

White light is a mixture of different color; a prism or similar device that produces a spectrum simply separates these colors.