When a light ray passes from a denser medium to a rarer medium, it travels in a straight path without bending.
When light travels from a rarer to a denser medium, it bends -