By the Text of the Spell
This spell holds 1d4 humans, demihumans, or humanoid creatures rigidly immobile for five or more rounds.
Held beings cannot move or speak, but they remain aware of events around them and can use abilities not requiring motion or speech.
AD&D is famously open to DM interpretation, but I don't see how you could interpret that in any other way than immobile.
Baldur's Gate and Icewind Dale use "a modified version" of AD&D, which may allow for such inconsistencies. I'm not sure all the modifications they made.
The game itself seems to agree with the D&D game though (and I never remember a Held creature doing this, but haven't played the game in ages):
Status Effect "Held":
The character is frozen for a number of seconds. They cannot move, attack, or use items.
Sources of the "Held" condition:
- Hold Person
- Hold Animal
- Ghast attack
- Shadow attack
Attacks of Opportunity
These became available in the Player's Option: Combat and Tactics supplement.
Attacks of opportunity occur when a threatened character or creature
ignores the enemy next to it or turns its back on a foe. The
threatening enemy gets to make an immediate melee attack (or sequence
of attacks for monsters with multiple attacks) against the threatened
creature. Attacks of opportunity cannot be performed with missile
weapons. This is a free attack that does not take the place of any
actions the threatening creature had already planned.
My best guess, maybe the creators of Baldur's Gate/Icewind Dale interpreted the spell differently than the obvious way it should be interpreted. Or, maybe their code for "do an attack of opportunity" superseded their code for "Held person" due to a bug.