dnd 5e – Can a player controlling an NPC use its Legendary Actions?

Strictly speaking, a Player Character doesn’t know a creature’s statblock; Mind control is almost always left up to the GM

Thus, you simply cannot tell a creature to use a legendary action in as many words; you’d instead have to describe what you want the creature to do and then the GM would determine how that plays out. This is the case for mind control in general, and this is no exception.

That said, let’s look at dominate monster more closely:

While the creature is charmed, you have a telepathic link with it as long as the two of you are on the same plane of existence. You can use this telepathic link to issue commands to the creature while you are conscious (no action required), which it does its best to obey. You can specify a simple and general course of action, such as “Attack that creature,” “Run over there,” or “Fetch that object.” If the creature completes the order and doesn’t receive further direction from you, it defends and preserves itself to the best of its ability.

You can use your action to take total and precise control of the target. Until the end of your next turn, the creature takes only the actions you choose, and doesn’t do anything that you don’t allow it to do. During this time, you can also cause the creature to use a reaction, but this requires you to use your own reaction as well.

You cannot specifically tell a monster to use a particular legendary, lair, or other sort of action because that command would be far more specific than a general course of action. In order to do this, you would have to take total and precise control of the target, which the spell explicitly allows you to do. Then you would have to describe what you want the creature to do and the GM would narrate the results.

Similarly, the Necromancy Wizard’s Command Undead feature says that the creature “obeys your commands”. What this means, what you can command it to do, the amount of knowledge you have about its available actions, and the precision allowed in your commands is entirely going to be up to the GM.