Viewport Navigation messed up on Blender 3.x

Sometimes the viewport rotation using the middle mouse button starts to rotate around an unusual point that is not very convenient. I don’t know why it starts doing this, but I’ve never had this problem with Blender 2.9x. Every time I rotate the same object, there’s a new center of rotation! Like, why the hell? Please help me disable this…

P.S. this is different from the other thing with Blender, which happens when you zoom in too much.

Open your preferences, go to Navigation, make sure both Orbit checkboxes are turned on. Then select your object and do Object menu > Origin > set origin to center (surface)