Hello ShivamSrivastava_7, welcome to the Microsoft community, my name is Bruno Leonel, an independent consultant and I would be happy to help you.
I understand that even if you set the computer not to sleep, after 5 minutes of inactivity it enters the lock screen.
In case you didn't understand correctly, I humbly apologize and also kindly describe a little more about it for a more accurate answer.
NOTE: Perform a test at each step performed. If it works, please disregard the following.
However, below are some steps that may help you.
Step 1
Click Start > Settings. (Or simultaneously press the Windows + i keys);
Click Personalization > Lock Screen;
Click on Screen saver settings check the option On restart, display login screen;
In front of the option Wait put the time you want and click Apply > Ok.
Step 2
Click Start and type CMD;
In the list of search results, right-click Command Prompt and click Run as Administrator;
When prompted by User Account Control, click Continue;
Type powercfg -h off and press Enter;
No message will be displayed, it will just go to the bottom row;
Restart the computer and check the behavior.
Step 3
Run the power troubleshooter.
On the Desktop, simultaneously press the Windows + R hotkeys to open Run.
Now type Control and click OK.
In the Control Panel in the right corner under "View by" select Large Icons.
Click Troubleshooting.
In the program solution window click Improve power usage.
Step 4
Clean Boot.
Press Windows keys + R type MSCONFIG and click Ok;
In the System Configuration window click on the General tab;
Check the option "Normal startup" then click on the Services tab;
At the bottom of the screen check the Hide all Microsoft services box and click Disable all;
Click Apply and OK.
Restart your computer and see the behavior.
NOTE: This procedure disables all third party services and programs. You can later, if the problem is solved in this way, selectively enable the programs and services that will start with Windows, instead of keeping all disabled. If the problem returns after activating the startup of a specific service or program, the problem is exactly in the startup of this software and it is recommended to remove it.
If the answer helped in any way, please mark it as an answer, if your question has not been solved, please post again.
I hope I helped, see you later!