When light ray pass from air into water, its speed and wavelength change only the frequency of the light doesn't change.
Light travels slower in a medium of higher refractive index. It bends because of this change in speed. The wavelength of light also changes in order to maintain the constant frequency.
At the present time, the only way we know of that light can get shifted
toward the blue end of the spectrum is the Doppler effect ... wavelengths
appear shorter than they should be when the source is moving toward us.
IF that's true in the case of the Andromeda galaxy, it means the galaxy is
moving toward us.
We use the same reasoning to conclude that all the galaxies whose light is red-shifted are moving away from us. That includes the vast majority of all galaxies that we can see, and it strongly supports the theory of the big bang
and the expanding universe.
If somebody ever comes along and discovers a DIFFERENT way that light
can get shifted to new, longer or shorter wavelengths, then pretty much all
of modern Cosmology will be out the window. There's a lot riding on the
Doppler effect !