Direction of loop selection

Basically, selecting a loop using the Alt key works well, but sometimes a blender chooses a weird path. Alt + edge selection sometimes does not work correctly and causes inconvenience. Perhaps I accidentally go into some sort of special mode. How to return to the basic function?
Ok select:

Not ok select:

I suppose you are accidentally click alt+ctrl+mouse instead of alt+mouse (or alt+shift+mouse)