a virtual machine
A virtual machine is a complete computer that exists only as software. Picture a flight simulator: it has a cockpit, gauges, and controls that behave so faithfully that a pilot can train as if flying a real plane — yet it is all software running on the ground. A virtual machine is that, but for a computer: it presents a guest operating system with a virtual CPU, virtual memory, a virtual disk, and a virtual network card, and the guest installs and boots inside it exactly as it would on a physical box, never realizing it is not metal.
Concretely, a virtual machine is created and supervised by a hypervisor. The hypervisor hands the VM a slice of the real CPU time, a region of real memory presented as if starting at address zero, and a file on disk that the guest treats as a whole hard drive. When the guest tries something privileged — say, reprogramming the interrupt controller — the hypervisor intercepts it and either performs the action on the guest's behalf or fakes a plausible result, so the guest stays inside its sandbox. From the guest's point of view it is a normal machine; from the host's point of view a VM is just one big managed process plus a disk image file.
Virtual machines matter because the whole machine becomes a movable, copyable object. You can pause a VM, snapshot its exact state, clone it, ship it to another server, or roll it back after a bad update — things you cannot do to a physical computer. The cost is real: a VM carries an entire guest operating system in memory and adds a layer of indirection, so it is heavier and slower to start than a container. The benefit is strong isolation, because each VM runs its own kernel rather than sharing the host's.
A developer runs Windows on their laptop but needs to test a program on Linux. They start a Linux virtual machine in a window: it boots its own Linux kernel, gets its own desktop, and the developer can crash it, reset it to a snapshot, and try again without touching the host Windows at all.
A whole Linux computer running inside a window on a Windows host.
A virtual machine runs a full guest operating system with its own kernel, which is exactly what makes it isolated but also heavy; this is the key contrast with a container, which shares the host kernel and is far lighter but more weakly isolated.