tools.guest.desktop.autolock in a VM's vmx file doesn't work for Linux guests only.
ESXi 8.x
The implementation of the ESXi setting "tools.guest.desktop.autolock" relies on support from VMware Tools, specifically within the desktopEvent plugin. This plugin currently supports autolock functionality only for Windows guests, and not for Linux operating systems.
While the RPC is registered across all platforms, the guest-side plugin implementation is available only for Windows.
This feature is currently designed to work exclusively with Windows guests. For Linux OS, it will be considered as a feature request.
You can submit a feature request here: Submit a VMware feature request