"Docker for Mac" is actually a full Linux virtual machine. The Docker commands you run on your host mac are sent into the Linux VM, to run the technologies Docker uses ("control groups" and "namespaces" mainly). The Linux VM is hidden as an implementation detail of Docker for Mac, meaning you can't ssh into the VM, you can only interact with it through Docker commands.
On Linux itself, Docker simply uses the same core Linux technologies to create the isolated runtime "containers" using "control groups" and "namespaces." Docker on Linux is basically native speed because it doesn't have to jump through hoops like syncing the VM filesystem with the host Mac's filesystem, which is a major point of slowness and a long standing pain point with Docker for Mac.
It really hinges on these things called "control groups" and "namespaces," which are features of the Linux kernel. The "kernel" is the core computer program that interfaces with the hardware. MacOS has its own kernel. (If you install htop for mac, run htop at a terminal, press "t" to go into tree view, and scroll to the top, you'll see kernel_task, the representation of the kernel).
A "control group" (or "cgroup") is a feature of the Linux kernel that lets you create an environment with a fixed allocation of memory, CPU, and other resources. Aka a controlled group of resources. Whatever runs in here only gets the resources defined by whoever created the cgroup.
The other feature is "namespaces", aka a "process namespace." It's another feature of the Linux kernel that lets you create an isolated namespace for processes to run in. If you're a process running inside this namespace, to you, it looks like you're the only process on the system. You can run multiple processes in a namespace (Docker containers can run more than one process!)
So on Linux, to create a container, you basically use native Linux features to build this isolated environment, and run some process(es) in it. This is also why there are different ways to run containers (BSD jails), really what we're talking about is building an isolated environment.
As far as I know, the Mac kernel doesn't have these same features to create isolated environments, which is likely why Docker for Mac went with a full Linux VM, which includes the kernel. This is approaching the limit of my knowledge. I don't know what the Mac kernel is missing or what gaps or proposals there are to create a container-like environment. I also haven't worked with BSD jails or other technologies so I don't know how portable containers are between systems, if at all.
MacOS is based on a Mach kernel with a BSD userland. It’s unixy but containers are a Linux thing based on namespaces and cgroups among other things all of which are Linux kernel primitives.
BSD has jails which are similar but different.
So the answer is MacOS doesn’t offer containers like you know them because it’s not linux hence Docker for Mac spins up a VM.
On Linux itself, Docker simply uses the same core Linux technologies to create the isolated runtime "containers" using "control groups" and "namespaces." Docker on Linux is basically native speed because it doesn't have to jump through hoops like syncing the VM filesystem with the host Mac's filesystem, which is a major point of slowness and a long standing pain point with Docker for Mac.