A physical server has real CPUs, RAM, disks, and network cards. A virtual machine takes a slice of those resources and presents them to a guest operating system as if they were a dedicated physical computer. The guest OS boots, installs drivers, and runs programs without knowing it is sharing the box with other VMs.
The piece of software that creates and manages VMs is called a hypervisor. A Type 1 hypervisor (also called bare metal) runs directly on the hardware, like VMware ESXi, Microsoft Hyper-V, KVM on Linux, or Xen. A Type 2 hypervisor runs as an application inside a host OS, like VirtualBox or VMware Workstation on your laptop. Cloud providers run Type 1 hypervisors because they are faster and more secure for multi-tenant use.
Each VM gets a virtual disk (a file like a .vmdk or .qcow2), a configured amount of RAM, a set of virtual CPU cores, and one or more virtual network interfaces. You can pause a VM, snapshot it, copy it, or move it to another physical host while it keeps running, which is called live migration.