To play Devil's Advocate here, it is not strictly RAW to disallow spellcasting. Of course, it is a sensible house rule -- but it would be a house rule if you disallowed it.
Sage Advice says you can
This tweet from Jeremy Crawford explicitly states that being underwater doesn't interfere with spellcasting. There is no conditional "Yes, if they can breathe underwater"
Sage Advice says you can, but only if you can breathe underwater?
Another Sage Advice tweet from Jeremy Crawford says that, if you can breathe underwater, you can perform the verbal components of spells. Fair enough. However, this is NOT the same as "if you can't breathe underwater, you can't perform the verbal components of spells" either.
Just as saying "if you can sing, you have a voice" is true, but "if you can't sing, you don't have a voice" is not necessarily true. Again, strictly speaking, nothing is disallowing spellcasting here yet.
The PHB says you have to be able to talk?
As @NautArch has shown, the PHB does mention a rule on V components of spells that seems like it should affect spellcasting.
Most spells require the chanting of mystic words. The words themselves aren’t the source of the spell’s power; rather, the particular combination of sounds, with specific pitch and resonance, sets the threads of magic in motion. Thus, a character who is gagged or in an area of silence, such as one created by the silence spell, can’t cast a spell with a verbal component.
This question on Quora asks if we can talk normally underwater. Well, the answer is yes, we can speak normally. The question is just, can the person you're speaking to understand you?
Well, in spellcasting, nobody needs to understand you. You just need to produce mystic words that form a combination of sounds, with a specific pitch and resonance. Note that you can always do this underwater, it's just that the sound is formed in your larynx and becomes distorted as soon as it touches the water. But the rules don't say "the sounds must reach outside your larynx" or "others must hear you clearly". You can technically still do it.
Moreover, every spellcaster will likely have different ways of casting the same spell, just because they naturally have different voices. It is not against the rules to consider that there are multiple ways you can set pitch and resonance, but still cause the weaves of magic to be set in motion in the same way. So, sound can still travel through water. Why can't a magic user speak those mystic words in a way that, when the sound travels underwater, the specific pitch and resonance still matches what is needed to pull off the spell? RAW, this is not illegal.
But Gagged prohibits spellcasting, so why doesn't being underwater?
There are many ways to wave this away. Any answer I give will not be RAW, and is in DM fiat territory absolutely.
Nonetheless, you can argue that when you are gagged, your tongue cannot move about and you cannot shape the sounds and words precisely because of this, whereas being underwater does not forbid this.
You can also say that being gagged restricts your jaw movement, but being underwater doesn't, so you still retain enough control to be able to cast while submerged.
Sensible House Rules
Casting underwater is different from casting in air, this is true. How you handle this is up to you. This Enworld discussion shows a few ways other DMs handle it, in the order of their appearance in that thread:
- Spellcasting is totally disallowed underwater unless the caster can speak underwater
- Allow spellcasting underwater without penalties, as there is no rule actually forbidding it
- Have the caster perform a check. On a failure, the spell slot is not wasted, but the action is lost. But only do this if: 1) there was a way around this issue, or 2) being in the water is intended to be a penalty. Otherwise, just let the casters cast normally.
- If spellcasting is penalized underwater, non-casters must be similarly penalized
- Allow one spell to be cast, but then immediately have the caster start drowning
- Require a concentration check before casting a spell
- Disallow spellcasting for a one-off encounter, but allow it if the characters are expected to be under the water for extended periods
Definitive JC Tweet. This is the RAI:
You can cast a single spell underwater, but afterwards you begin drowning if you can't breathe underwater. Otherwise, no rule prevents verbal components from working underwater. Thanks to @mxyzplk for bringing this tweet to my attention!
Extra Note: In that Twitter thread, Dan Dillon asks:
Is the intent that if you cast a verbal component spell you're no longer holding your breath (and now on Con mod +1 rnds)?
To which Jeremy replies "yes." But technically it is Con mod rounds only, without the +1. The +1 only happens when you've held your breath and have Con mod + 1 minutes before you start drowning.