Why does shifting under power affect shift quality?
There may be other factors that affect "shift quality", if I understand what you meant correctly, but the most significant by far is “direction of force applied.

Basically for a gear to change the mechanism just pushes the chain “off rail” enough in the direction of the new gear. When the chain has a higher tension applied on it the derailleur doesn’t have enough strength to push the chain “off the rail”. (Derailleur is the name of the part the pushes the chain)
If you still haven’t understood, imagine a line stretched between two fixed poles, if it is loose and you push it to the side it will move some, if it has a higher tension and you push to the side with the same strength and direction than before it will move less. And the tighter the line the less to the side it would move. A gear system has a minimum distance that it needs to move to the side so it can change gears.

More advanced, modern and obviously expensive have over time placed gears closer to each other and shaped individuals to make the “derailing” need a smaller push in a new direction, requiring less strength to push the chain and as a whole make the process more smooth.

If you didn’t understand something just ask.