Can i use a virtual machine?
Yes, I would advise this if you're completely new just to sample it.
I knew someone who accidentally nuked their data drive once when installing Ubuntu, easily avoided btw.
As for what is better, at the risk of sounding like a lawyer, I go with 'it depends'.
I tend to use a mix of Windows and Linux depending on my needs because not everything I want to use is Linux compatible (even with Proton or WINE) and some of the alternatives I have issues with for one reason or another.
But then some people don't have this issue and are completely fine with what does work on Linux and prefer the flexibility Linux can provide.
Then there's things such as resource usage, with Linux generally regarded as being 'lighter' than Windows, particularly useful on older or weaker hardware.
you have to write code to install the ones that are compatible
I think you're thinking of 'compile from source', which shouldn't requiring writing any code and usually instructions are provided.
Besides, this isn't always the case where software may be available in pre-compiled package form (e.g. the distros repo) or something like Flatpak.