It does not have anything to do with water being bad for your lungs. It has everything to do with oxygen being good for your lungs.
Your lungs must exchange oxygen and CO2 or you will die. Your lungs can’t make that exchange if they are full of water. The water will displace the gaseous oxygen from your lungs. Water is fine as long as there is room for O2 in and CO2 out as well.
Fun Fact: It is possible to survive for a time breathing 100% liquid if it is highly oxygenated, such as Perflourocarbons. The movie The Abyss features deep sea divers doing just this. Yes, the movie is fiction, but the principle is sound. Our lungs “breath” liquid for months when we are in the womb (oxygen provided by umbilical cord).