Commander damage is tracked as the total combat damage a specific commander deals to a specific player over the course of the game (Commander rule, alongside CR 120.3 and 120.6). The critical point is that the amount of damage dealt is determined by the creature's power at the moment damage is assigned and dealt, not by any base stat.
When a continuous effect swaps a creature's power and toughness (for example, the effect of a card like Minion Reflector or Turn Sideways, or more commonly an effect like Invert), that swap is applied during the calculation of the creature's characteristics under the layer system (CR 613.3, layer 7c for power/toughness switching). So if your commander is, say, 3/6 and a swap effect is active, it is treated as a 6/3 — it deals 6 combat damage.
That 6 damage dealt in combat counts toward the 21-commander-damage threshold under the Commander rules. The game only cares about how much damage was actually dealt, not what the 'original' power was. See CR 120.3: damage is dealt in the amount determined by the object's current power.
Concrete example: Your commander Doran, the Siege Tower is normally 0/5 (and has an ability making creatures assign combat damage equal to toughness, but ignore that). Suppose instead a generic swap effect makes your 2/8 commander become 8/2. When it deals combat damage unblocked, it deals 8 damage to the opponent — all 8 count as commander damage toward the 21-damage threshold.
There is no exception in the Commander rules for 'artificial' power increases from swap effects. Whatever damage is dealt in combat by your commander is tracked as commander damage (CR 120.6, Commander Rules 10).
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.