When I was using Linux I used to use Linux namespaces:
https://man7.org/linux/man-pages/man7/namespaces.7.html
Also on FreeBSD, there are jails:
https://www.freebsd.org/cgi/man.cgi?jail
I was wondering what the alternative was on macOS 12? I'm new to Macs so I'm just trying to learn the system and any features it might have.
The equivalent feature to FreeBSD's jails and linux namespaces for macOS is the App Sandbox.
You can find relevant details in the App Sandbox Design Guide.