Hello Sanaa Al-Tamimi,
Thank you for posting in Q&A forum.
There is no such existing GPO setting for your request, however, you can try one of the links below.
HOW TO AUTO SHUTDOWN WINDOWS WHEN IT’S BEEN IDLE FOR A WHILE
https://onmsft.com/how-to/auto-shutdown-your-windows/
Automatically reboot idle computers
http://www.intelliadmin.com/index.php/2015/03/automatically-reboot-idle-computers/
How to: Auto log off users
https://community.spiceworks.com/how_to/37465-auto-log-off-users
This is for remote desktop session.
https://4sysops.com/archives/automatically-log-off-idle-users-in-windows/
**Tips:
1.Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.
- Please do some tests in lab before you deploy it in production environment.**
I hope the information above is helpful.
If you have any question or concern, please feel free to let us know.
Best Regards,
Daisy Zhou