Apple makes it easy to compress files using the right-click contextual compression command, but it provides no easy way to add a password to the resulting zip file. You can use the Terminal program to add a password, but it’s prone to mistakes and more time consuming.
Instead, use this program called Keka.
Keka is a free file archiver for Mac OS X. The main compression core is p7zip (7-zip port).
Compression formats supported: 7z, Zip, Tar, Gzip, Bzip2, DMG, ISO
Extraction formats supported: RAR, 7z, Lzma, Zip, Tar, Gzip, Bzip2, ISO, EXE, CAB, PAX, ACE (PPC)