The boundary
When light enters glass from air, its speed changes. The beam bends as it crosses the boundary between two optical environments.
The angle
The angle of entry and the refractive properties of the material determine how far the path turns.
The return
At another surface, the beam can bend again. A simple object becomes a sequence of directional decisions.
The prism does not create light. It changes the route light is already taking.