what is hacking the virtual machine usefull for?

so i was watching a ethical hacking course . There the tutor taught to hack into different virtual machines and also machines from hack the box .So i wanted to know in the real world these practices of hacking virtual machine will be useful for what kind of hacking?