The bending of light in passing from one medium to another is due to refractive index of second medium with respect to first. The refractive index is related to the speed of light in two media as ‌1µ2=
Speed‌of‌light‌in‌first‌medium
Speed‌of‌light‌in‌second‌medium
Thus, on passing from one medium to second medium, the speed of light different.