Can you be more specific about what you're talking about? Visual Studio doesn't have any "lock" capability out of the box. It almost sounds like you're talking about the old TFVC integration where files could be exclusively locked. Are you using Tfvc as a source control system? If not then I'm going to lean toward this being from some extension you have installed.
Locked Items Unlock Automatically

Albert Vadacchino
21
Reputation points
Hi,
I have locked items (Files or Folders or Projects) and after a few days, they are all unlocked.
Any idea why?
To lock the item, I right-click on it, go down to "Advance" and then click on LOCK, and the confirm LOCK and the next screen.
Thanks.