A virtual machine is as a software program that, just like a physical computer, runs an operating system and executes programs. Multiple virtual machines can exist within a single host at one time. Each virtual machine contains its own virtual hardware, including a virtual CPU, memory, hard disk, and network interface cards, which provide the same functionality as the physical hardware to the operating systems and applications.
Here is a picture of Oracle VirtualBox running multiple virtual machines with different operating systems installed:
The operating system running inside a virtual machine is known as the guest operating system. You install and manage the guest OS in much the same way like you would do with an operating system on a physical machine. The guest operating system installation is usually carried out using a CD-ROM, DVD, or an ISO image that contains the operating system installation files.