In Android 11, pressing and holding the power button opens a menu from which you can power off or restart your phone.
In Android 12, Google have slightly altered the default setting for the power button. Pressing and holding the power key down activates the Google Assistant. For the power off and restart menu, press the power key and volume up key simultaneously.
If you want to change the behaviour of the power button back to that of Android 11, navigate to