Loosely speaking a VM behaves and has the same demands as a physical machine. It needs an OS and all the baggage that goes with it.
A container is ringfenced for your application but shares the host OS. That means that a container is smaller and faster to boot up.
I could have a container running PostGres, another running Python 3.7 with a bunch of libraries, Python 3.9 with a different set of libraries and versions of those libraries, a SQL Server container etc. All independent and not interfering with each other.
If I installed those things on a single machine rather than in containers I might get a conflict between apps or the libraries they use.
I haven't touched a VM for ages but I do use containers all the time.
I recommend looking at videos, books and training courses by Nigel Poulton. He explains things really well and with infectious enthusiasm.
I've shied away from Kubernetes (K8s). It's a level of complexity I just don't need in my life right now. Again, if the time comes when I need it, Nigel Poulton is your man to explain it