The hydra is a LEVEL 6 monster, and if you are soloing it you'd want to have say level 15 dodger, these days. Before v43.xx when there was no force transfer effect, you could get away with say level 8-9 dodger.
The hydra is BIG and will charge you, maybe knocking you down, and maybe stunning you.
Stun debuffs by 50%, and will take your level 15 dodger and make it a level 7, closing the stat gap in its favor.
The hydra has NOEXERT in the raws, so it will never get tired. It's preferable to have superior endurance to manage this.
The hydra has ATTACK_FLAG_INDEPENDENT_MULTIATTACK in the raws, making it the only multi-attacking AI in the vanilla game. That's 7 bite attacks that you have to defend against.
Of the possible 3 positions in DF combat:
adjacent tile, same tile, and separated-by-1-tile (kite mode), only kiting solves these all problems. To kite, you wait (press comma key) until the hydra is on an adjacent tile, and then you multi-attack by spamming the combo (quick attack + dodge away) stabbing with either spear or sword. Kiting limits the number of bite attacks as dodging away results in a tile of separation between you and the hydra. Not all the attacks prepared will have the time to land. A shield block will only defend against 1 attack, but dodge allows you to defend against them all.
The optimal order of attacks not just for the hydra, but every breathing biped/quadruped is leg(s) > lower body > upper body.You need to damage 2 legs on a quadruped to ground it so it can't charge you.
Then move your multi-attack spam up to the lower body until you cause nausea.
Nausea debuffs by 50% bringing the hydra down from level 6 to level 3.
Lastly you spam the upper body to damage the lungs as many mentioned.
The hydra usually dies from cumulative blood loss or suffocation and you're just trying to find the way to bring this about in the safest (for you) and most efficient way possible.
Hope this helps.