An emulator is ~SIMPLY~ a piece of software to replicate within a computer the hardware of another device. This is true of Virtual Machine programs as well.
Example:
I have a DS Emulator that I (theoretically) use to play the ROM's of 5 of the 7 Pokemon game I ~LEGALLY~ own the carts of (DPPT & HGSS), as under Fair Use laws (particularly of Australia) whilst I own a legitimate copy of a piece of data (be it a Vinal LP of Elvis, a Diablo II CD set, or a DS Cart), I can legally create, own & use a backup copy of said data (LP into MP3, CD's into ISO's, Cart into ROM) to use in lieu of the original item. However, under these same laws, if I sold off (or otherwise handed over) the original form of the data (the LP, CD's or Cart) then I either have to hand over the copy (MP3, ISO, ROM) of the data (eg: any CD's I made from the ISO's) or destroy (delete) it.
A Virtual Machine (or VM) works similarly except it replicates the hardware environment of a computer system inside an Operating System (or OS) in order to run other OSes, typically for either testing OSes and programs before roll-out (aka: installing) or to run an OS for older programs that do not run in a current OS or an OS that is of a different maker (eg: running Win95/98 games on Win7, or 95/98 games on a Linux distro).
Both times you are using one piece of software to run another piece of software outside of the typical boundaries of hardware, yet one gets branded with the term "Piracy" (Emulation of console hardware for console games) and the other one is done without any negative branding (emulation of computer hardware to run computer programs (including games)) even though BOTH can be used to run programs legally or illegally (eg: using a VM in Linux to run a copy of Windows 7, either to prevent another sale of over-priced software, or to test the OS before deciding on building a system with Win7).
In fact, when you get down to brass tacks, a Console Emulator is little more than a Virtual Machine aimed at replicating console hardware as software on a more capable platform.