One of the most important aspects of the .NET virtual machine is the reason why it is called the Common Language Runtime.
All .NET programming languages compile to the same bytecode format which is executed in the same VM. This allows programs where different parts are written in different programming languages to interoperate seamlessly.
Virtual machines also have performance advantages, because they allow just-in-time compilation and just-in-time optimization. A common offline compiler can only optimize for a specific CPU architecture. When an application is distributed and the user doesn't have exactly the same system the application was optimized for, they will experience slightly worse performance than possible. But a JIT compiler can check the architecture when the program is executed and make full use of the features available. Also, a common offline optimizer can only make educated guesses which parts of a program are executed most often and thus have to be preferred during optimization. But a JIT optimizer can monitor the program while it is running, check which branches are used most often, and optimize the program on-the-fly while it is running.
But the Java VM can do all of that too. Why isn't Microsoft targeting the JVM then? It's for business reasons. Microsoft is known for wanting as much control as possible over the whole stack an application runs on. Having Sun (now Oracle) control a major part of the software development ecosystem was considered a problem for them. Especially when it allows software to run on non-Microsoft operating systems! So they developed their .NET framework as a direct competition to Java to attack Sun's (now Oracle's) market share.