All storage is encrypted by default on recent Mac gear, even if you have not selected a FileVault password. Which means the default state of the files is already password-protected.
For added encryption for cases such as if your macOS login is at risk, Mac usually uses an encrypted volume.
Create a disk image using Disk Utility on Mac - Apple Support
With a folder of stuff you want to protect, Finder > Applications > Utilities > Disk Utility app, from the menu, select File > New Image > Image from Folder. Select the folder you want to password protect.
Other options include Fast User switching, and a second login.
There are lots of GUI apps around that can encrypt files as mentioned in earlier replies, and it’s entirely feasible to create your own tools to do that using the built-in encryption support. The command-line zip and unzip, as well as the openssl command, or by adding a tool such as age.