If someone casts slow on a Hydra where two heads are visible above water but 5 heads and the body are beneath the water, does it affect the entire creature or just the two visible heads?
It affects the entire creature
The spell slow states that it chooses targets as follows (emphasis mine):
You alter time around up to six creatures of your choice in a 40-foot cube within range. Each target must succeed on a Wisdom saving throw or be affected by this spell for the duration.
A Hydra's heads and its body are not distinct creatures, so they are all affected by slow if the Hydra is designated as a target by the caster and fails its save.
The whole thing
A Hydra is not multiple creatures. It is one creature with multiple heads.
You alter time around up to six creatures of your choice in a 40-foot cube within range. [...] An affected target's speed is halved, it takes a −2 penalty to AC and Dexterity saving throws, and it can't use reactions.
The spell targets creatures.
The only benefits a Hydra has from having multiple heads are...
- While it has more than one head, the hydra has advantage on saving throws against being blinded, charmed, deafened, frightened, stunned, and knocked unconscious.
[Snip part about losing heads and regenerating them, as this is not relevant to the question]
- For each head the hydra has beyond one, it gets an extra reaction that can be used only for opportunity attacks.
There is nothing in here that states that a hydra's heads count as different creatures. If they did, they would move separately in the initiative order.
In order to target a creature with the spell Slow, you only need line of effect.
To target something, you must have a clear path to it, so it can't be behind total cover.
Its head is sticking out, so it doesn't have Total Cover. Slow doesn't even specify that you have to pick targets you can See.
Thus, yes. Casting Slow on even a single head of a Hydra hits the whole creature (and yes, shuts down ALL of the heads' ability to use Reactions for Opportunity Attacks).
A Hydra is a singular creature for the affects of Slow. Targeting any of it affects all of it. There is nothing in the Hydra's abilities that allow only specific heads to be targeted, the closest thing being that any time it sleeps, at least one of its heads remains alert.
Whether or not you can hit a Hydra with Slow when only seeing two of its heads is up to your GM... but assuming they agree that you can hit it, you're affecting the entire Hydra.
The Hydra's multiple heads are a Trait of the creature, not distinct entities, so the Slow spell would affect the entire Hydra, if it's within the area of effect:
Multiple Heads. The hydra has five heads. While it has more than one head, the hydra has advantage on saving throws against being blinded, charmed, deafened, frightened, stunned, and knocked unconscious. Whenever the hydra takes 25 or more damage in a single turn, one of its heads dies. If all its heads die, the hydra dies. At the end of its turn, it grows two heads for each of its heads that died since its last turn, unless it has taken fire damage since its last turn. The hydra regains 10 hit points for each head regrown in this way.