Symmetry in quantum mechanics

In a context like this, a symmetry is a transformation that converts solutions of the equation(s) of motion to other solutions of the equation(s) of motion.

In this case, the equation of motion is the Schrödinger equation $$ i\hbar\frac{d}{dt}\psi=H\psi. \tag{1} $$ We can multiply both sides of equation (1) by $U$ to get $$ Ui\hbar\frac{d}{dt}\psi=UH\psi. \tag{2} $$ If $UH=HU$ and $U$ is independent of time, then equation (2) may be rewritten as $$ i\hbar\frac{d}{dt}U\psi=HU\psi. \tag{3} $$ which says that if $\psi$ solves equation (1), then so does $U\psi$, so $U$ is a symmetry.


For a more general definition of symmetry in QM, see

Symmetry transformations on a quantum system; Definitions