Why does VirtualBox crash macOS?
This is commonly due to bugs in VirtualBox.

VirtualBox installs itself as a kernel extension directly into the lowest level of kernel software running on your Mac affecting stability of the system as a whole. This is why you need to enter an administrative user’s password in order to install VirtualBox.

To fix this, ensure that you have the latest software versions of VirtualBox, add-on packs and macOS installed. Double-check your virtual machine configuration for configuration errors (especially if you’re using PCIe pass-through or similar).

If this doesn’t solve your problem, I will advise using a different virtualization system such as VMware Fusion or Parallels Desktop.