Apple had their old creaky OS, had just failed doing a deal with another OS company and then just jumped into BSD.
Around '96 Apple was internally working on a new OS that was a failure and bought NeXT started by this guy you may have heard of named Steve Jobs. They then ported NeXT to PPC, replaced Display Postscript with Quartz, added a few classic MacOS technologies and the Carbon API to make developing apps compatible with OS X and classic Mac OS.
OS X. Is based on the internally written NuKernal with a BSD user level and the Next API's.