A virtual machine in a blockchain context is an emulation of a computer system that executes smart contracts and runs decentralized applications.
For example, the Ethereum Virtual Machine (EVM) allows for the execution of code exactly as intended, providing the backbone for Ethereum's smart contract capabilities.