White light is made up of different colors. A prism enables white light passing through it to separate into its different constituent colors. These colors are the colors we see in a rainbow. Sunlight consists of white light. So when sunlight enters (and exits) a falling raindrop, it separates into its different component colors. These colors are: Red, orange, yellow, green, blue, indigo, violet. Hence, raindrops act like a sort of mini-prism.
Check out a video of a prism:
When white light passes through a prism, it enters one of the surfaces and exits another surface. The first surface causes the white light to separate into its component colors, and the second surface increases the degree of separation (i.e. the colors "fan out" more).
The separation of light into its components is due to the nature of light. As light moves from one medium to another (e.g. from air into the prism) it changes speed. This speed change causes the light to refract (bend) and to pass through the (new) medium at an angle different from the incident angle. The degree of bending of the light depends on the color of the light. So if the light entering the medium is made up of different component colors (such as white light), each color will bend a different amount. This causes the "fanning out" effect we see which allows us to see the different component colors of the light entering the prism.
You can get a prism and hold it out in the sun and see the resulting separation of colors, just like you see in a rainbow. You can also try other sources of light, such as a flashlight, and see what happens.