The hydra can take them all at the same time in response to a single trigger or pace them out over a round in response to multiple triggers.
Here's the text of the feature we're talking about (from the hydra's stat block):
Reactive Heads. For each head the hydra has beyond one, it gets an extra reaction that can be used only for opportunity attacks.
And here's an explanation of how reactions are used, when you get them, and how opportunity attacks are triggered (from the Combat chapter of the Basic Rules):
A reaction is an instant response to a trigger of some kind, which can occur on your turn or on someone else's. The opportunity attack... is the most common type of reaction....When you take a reaction, you can't take another one until the start of your next turn.... You can make an opportunity attack when a hostile creature that you can see moves out of your reach. To make the opportunity attack, you use your reaction to make one melee attack against the provoking creature. The attack occurs right before the creature leaves your reach.
Combining these together, the hydra, unlike most creatures, has more than one reaction they can take per round (the extras can only be used for opportunity attacks, not Ready actions or other reaction options), regaining any spent reactions at the start of its next turn. There's no restriction to when those reactions can occur within that time frame, so they could happen simultaneously or separately over the course of the round, as the hydra chooses.
In addition, there is no rule that a provocation, such as moving out of a hydra's reach, can only incur one opportunity attack. This means that whether multiple creatures are taking opportunity attacks or one creature's multiple heads are doing it, they can still all happen at once in response to the same provoking trigger.