to me, it kind of sounds like you have inadvertently activated a "hot corner" for the top right corner of your desktop.
for Ventura or Sonoma, go into System Settings > Desktop & Dock. then in the right panel, scroll down until you see the "hot corners" button.
![](https://discussions.apple.com/content/attachment/2510c0a6-1951-4b4f-bb20-00090df02b19)
then click the "Hot corners" button and ensure if it is set as "Lock Screen". if it is, you can change it to show "-" and your screen will stop locking whenever you mouse over your top right corner.
![](https://discussions.apple.com/content/attachment/8188bb1b-a234-4964-bbfc-4804b00800f9)
but in monterey and before, go into System Preferences > Desktop & Screen Saver.
![](https://discussions.apple.com/content/attachment/84bbfc5c-5dbd-4b5e-a996-72f4f451ce29)
then in the "screen saver" tab, click on "hot corners".
![](https://discussions.apple.com/content/attachment/dbb05143-991a-44de-a2fd-081fc2153b77)
and again, check your "hot corners" settings.
![](https://discussions.apple.com/content/attachment/ca2bdd32-394e-499a-97ed-b739fed1f903)