Very simple yet very complex.
The MBR is nothing but a x first part of a partition, often first part of the HDD.
The bios gives the hardware control to the MBR which stages the rest of the boot.
This MBR is writeable just like like any other part of the HDD.
Thus the complex part, some malicious code can be inserted onto these sectors.
Writing a boot sector virus is some neat skill.