White light comprises of seven colours- Violet, Indigo, Blue. Green, Yellow, Orange , Red.
So, when white light consisting of seven colors falls on a transparent medium (glass prism) , each color in it is refracted ( or deviated ) by a different angle , with the result that seven colors are spread out to form a spectrum, The red color is deviated least , so it forms the upper part of the spectrum . On the other hand, violet color is deviated the maximum, so violet appears at the bottom of the spectrum.