Light changes its path as the medium changes during the transit. This is because of
Change of frequency
Change of intensity
Change of speed
Change of wavelength
Speed of light is different in different media. Hence, the direction of the light changes.