I have searched on google for restrict a user to a specific directory but mostly appeared about ssh user, ftp user and etc that not local user.
How do we do that for local user?
You can use Firejail for this purpose, apt install firejail.
Running firejail --private=~/OnlyAccessibleDir will allow access only to ~/OnlyAccessibleDir directory.
firejail in conjuction with chroot. Check the documentation, firejail.wordpress.com/documentation-2/basic-usage/#chroot