The War Caster feat gives it the following property:
When the movement of a hostile creature causes an attack of opportunity from you, you can use your reaction to cast a spell on the creature, instead of making an attack of opportunity. The spell must have a casting time of 1 action and must target only that creature.
A Hydra has the following feature:
Reactive heads For each head that the hydra has beyond one, it gets an additional reaction that can be used only for attacks of opportunity.
Let's say that, for some reason, someone provokes an opportunity attack from a War Pit Hydra (possible, for example, a Wizard of the War Pitter who launches a Change of Change to become a Hydra) … what happens ?
1) The War Caster Hydra can use all their heads for opportunity attacks, or just one head for an eligible spell
2) The War Caster Hydra can use all their heads for opportunity attacks and / or eligible spells
I suspect that the correct answer is 1), but it is better to verify.