When Apple purchased the company NeXT in 1997, they got not only CEO Steve Jobs from the deal, but also the smaller company's technologies. This included NeXTSTEP, the Unix-based operating system for NeXT machines.
Under Jobs' leadership, Apple then modified NeXTSTEP to work on Macintosh hardware. The result was MacOS X. Some Apple technologies were retained (e.g. QuickTime), whereas many others (many of which were seldom used anyway) were discarded. In addition, Apple tried to keep backwards compatibility with the Classic run-time environment and the Carbon source-code API.
Darwin is the kernel andplus the low-level layers of MacOS X. It There is enough in Darwin that it could act as an operating system, but much of the usefulness of MacOS X is in the higher layers. Darwin is open source, but the resthigher layers of MacOS X is not.