If light reaches a transparent object like a prism 'straight on', it usually passes through it. But if it reaches the prism in a 'glancing' way, it bounces off. In this way a prism behaves like a mirror. Prisms in a pair of binoculars and in the periscope of a submarine work as mirrors in this way. They are used to make light turn at right angles.
But if the light reaches the prism in a more direct way, the light goes into the prism. Now something remarkable happens. White light (the sort of light we usually just call 'light') is made of many colours of light mixed up. When light enters the prism, those colours begin to separate out because each colour gets bent inside the prism in a slightly different direction. As a result, when the light comes out of another face of the prism, it is separated into its colours, and what you see is a rainbow of colours, also called a spectrum of colours.