Can you change the wavelength of light keeping frequency constant and can you do the opposite as well? I understood the basics but please don't hesitate to go deeper into the concept. Also, If you happened to have an elegant explanation please drop it here if you can.
Wavelength times frequency gives the speed of a wave: $\lambda \nu=v$. The speed of light in a vacuum is a constant, but light can move more slowly in media (for example in water). For a photon of fixed energy, the frequency is fixed, so the wavelength of light should change when it goes into a medium in which the speed of light is slower than in vacuum. In fact, the amount that the wavelength changes is related to the index of refraction $n$ of the medium. If the wavelength in vacuum is $\lambda_0$, then the wavelength in the medium will be $\lambda = \lambda_0/n$.
As mentioned, wavelength changes in different media depending on the index of refraction. Changing the frequency can be done with non-linear optical effects, notably frequency doubling and similar effects. This change in frequency has a corresponding change in wavelength however, as opposed to the change in wavelength in different(linear) media which holds frequency constant.
Why does frequency remain constant?
The reason that light does not change its frequency is because of conservation of energy. Light is made up of quanta (small discrete particles). The energy of light is proportional (or equal if you use appropriate units) to its frequency. $$E=nh\nu$$ Where $n$ is number of quanta. When this light ray goes to a different medium the energy must be conserved. Hence the frequency remains same. The relation between the new and the old wavelength can also be calculated using this relation.
Is the opposite possible?
To my knowledge the opposite is not possible for light rays. Since the speed of light is constant for every observer in a medium the frequency and wavelength must change. It is not possible to keep wavelength constant while changing the other two.
Hope this helps.