The speed is of the light is (generally speaking) reduced in the denser medium, so either the frequency or the wavelength must also be reduced to satisfy the equation v=λf.
In this case, it is the frequency that remains the same. Think of it in the classical sense as an oscillating electric field interacting with a group of electrons. The propagating photon’s field will act as a driving force that oscillates the electrons within the medium at a given frequency. The oscillating electrons pass the photon through the material, but they resist the motion due to dielectric screening. This causes both the wavelength and the speed of the wave to fall.
remember though, that the speed of a photon is always c, regardless of medium or reference frame, and it is the group velocity that propagates at v=cn