Traditionally the reason was that Macs had a different CPU architecture. They used PowerPC processors while other computers use x86-based processors. Software must be compiled for a specific architecture, hence not being able to install OS X on any standard computer at the time.
Now it's a little different. Apple has switched their CPU architecture to x86 by now using Intel processors. As a result, their operating system is now compiled for that, so that it would be theoretically possible to run on any x86 machine, but Apple wants to remain a hardware company selling machines running exclusive software, so the installation looks for a hardware indicator (I believe there is a chip for this, I can't quite remember) that tells the installer the machine is indeed a Mac. That and standard PCs use a BIOS while Apple's use EFI, but if this was the only prevention, it would be an easy issue to deal with.