On windows, there are many free (but closed-source) software to do it. But on linux, what you're looking is
https://wiki.archlinux.org/title/Fscrypt which is specifically designed to encrypt folder/directory.
However, as a super-simple method with similar results, isn't 7zip with AES 256 encryption good enough? Imho it's much easier to use...
Easy, but takes time and annoying if you want to update the file inside encrypted archive.