Virtual machines are just “virtual” computers. The concept of virtual machines differ depending on context. But in Web3, a virtual machine is a computer that runs code, specifically, code for smart contracts. As blockchain nodes receive transactions in and out, these virtual machines help these nodes run smart contracts.

Different blockchains use different names for virtual machines. Ethereum calls it Ethereum Virtual Machines while Solana calls it Expected Execution Environments.

In summary, blockchain nodes use virtual machines to run the smart contracts and their code to create transactions.