The legend rule (CR 704.5j) states that if a player controls two or more legendary permanents with the same name, that player chooses one and puts the rest into their owners' graveyards. This is a state-based action checked continuously, and it makes no exception for commanders.
Your commander being on the battlefield is treated like any other legendary permanent for the purposes of this rule. So if your commander is, say, Atraxa, Praetors' Voice, and you somehow put a second copy of Atraxa onto the battlefield (via reanimation, token copy effects that create a legendary, etc.), the legend rule immediately triggers and you must sacrifice one of them.
However, there is an important nuance: if the second copy is a token that happens to be a legendary creature with the same name (e.g., created by a card that makes a copy), the legend rule still applies. You choose one to keep and the other goes to the graveyard (or, if it's your commander, to the command zone via the commander replacement effect).
Example: Your commander is Ur-Dragon and it's on the battlefield. An opponent reanimates a second Ur-Dragon from your graveyard under your control. State-based actions immediately check: you control two legendary permanents named 'The Ur-Dragon.' You must put one into the graveyard. You may choose to keep the one in your graveyard going to the command zone (since your commander can be moved there instead) but you still cannot keep both.
The only way to control two permanents with the same legendary name is if an effect explicitly says the legend rule doesn't apply, such as the Eminence ability of some commanders or cards like Mirror Gallery (CR 704.5j, 704.5k).
Unofficial fan resource — not affiliated with or endorsed by Wizards of the Coast. Answers are AI-generated estimates grounded in the Comprehensive Rules and are not a substitute for an official judge. Verify anything match-critical.