Sandbox:
A "sandbox" is software that allows you to run an application in such a way that it prevents the application from writing outside of the sandbox.
Normally, when you run a program like your browser, it makes changes to your system; registry settings, internet caches, browsing history and the like are all written to disk. On top of that, downloads including things like potentially unwanted spyware also arrive via the browser and install themselves onto your hard disk so that the next time you run the browser - or the next time you even just boot your system, that spyware is still there, doing its spyware thing.
When run in a sandbox, all those changes still appear to happen, except that they're never actually permanently placed on disk. When you exit the browser and its containing sandbox, all those changes disappear. History, cache, settings and spyware.
Virtual Machines(VM):
Virtual Machines are, in essence, a virtual "entire PC in a window". When you start a virtual PC, for example, the first thing you see is a window open up in Windows that contains a virtual BIOS screen as it starts up and tries to boot.
The benefit of a virtual machine is that it can't directly modify the "real" Windows running on your machine. The virtual machine is assigned its own hard disk space, and that's what it treats as its virtual "entire hard disk". Any modifications you make within the machine - its settings for example - are stored on that virtual hard disk.
You can run a browser in a copy of an operating system running in a virtual machine and any settings it changes, any history it creates, and any spyware that it downloads affect only the virtual machine. If you keep a snapshot of an original virtual machine hard disk image then any time you find you want to discard all the settings, history and perhaps malware, all you need do is erase the current image and copy over the original to start again, clean.But if you can train yourself to do casual, or risky browsing only in the VM, then it's a great solution to prevent malware from reaching your machine.
ref:
http://ask-leo.com/does_a_sandbox_or_virtual_machine_help_protect_your_privacy.html