Well because operating systems are different, with respect to api calls and such. So are the processors operating on different architecture (such as arm vs x64). Usually with non portable code you have to recompile if you target another platform but you often have to make changes if you target another operating system. For instance, linux process creation is completely different than windows, so you code would not work if you use same code. But also windows expects one way a binary file is written (PE format starting with header MZ) while unix-derivatives (including some consoles) use elf binary file format.
As for why, well as a cpu designer you are free to do any sort of architecture you want. And for OS designer, again, api is usually completely free for you to choose.
Latest Answers