This is an article about the origins of OS X:
Now to make this easier to understand later: Mac OS X is atop an operating system called Darwin. Right now Darwin is at version 8.8.1, which is the only part of OS X following the right version number.
Mac OS X’s origins start in 1984, The Macintosh has just been released. It has been a great success, but sadly it wouldn’t last. After only a few months, problems were being found. The Mac OS was the first OS to be completely based on GUI, meaning no command line. This was a little scary for many people. Programmers had to struggle to get their command line programs working on the Mac, some didn’t even bother with it, calling the Macintosh a toy or a gimmick. This created a lot of stress for Steve Jobs, he became irritated and irrational. A person he hired for CEO of Apple, John Sculley, a person that he gotten along with very well, soon became an enemy in Steve’s eyes. He blamed Sculley for a lot of the problems, saying he had bad judgements.
Eventually, in 1985, the Board of directors lost their patience with Steve and stripped him of operational responsibilities. Steve left soon after with a few of his friends. In the same year Steve bought Lucasfilm’s Graphics Group for $5 million. He then renamed it Pixar. Pixar would later become the leader in cgi technologies, with almost every movie coming out of hollywood using Pixar’s Renderman. A list of movies rendered with Renderman are listed here.
Soon after, again in the same year(1985), Steve founded a new computer company called NeXT. Steve and his friends from Apple now working under NeXT created a plan to get a computer out by 88. They succeeded with the NeXTCube, but the OS wasn’t finished until 89. This OS, NeXTStep, is the origin of OS X.
NeXTStep 1.0 in 1989. You might notice the Dock on the side:

In 1990 NeXTStep 2.0 came out, this slowly progressed the system. NeXT though, was facing hardware problems. It’s computers were ranging from $6,000 to $10,000. Very few were being sold and NeXT was losing money. There were some people that bought the computers though, a few items developed on a NeXT computer included: The World Wide Web, the first “Web” browser(WWW), Wolfenstein 3D and Doom, and Lotus Improv. 1992 marked a landmark with NeXTStep, bringing out version 3. NeXT started to port their OS to other processors besides Motorola, including Intel’s and PowerPCs. In 93, NeXT finally left the computer business and stayed with Software only. Some OS X Apps you might know that were first created in NeXTStep include: Mail.app, Preview.app, and Interface Bulder.app. Another, Edit.app, became TextEdit.app.
A well known video of Steve Jobs Demoing NeXTStep 3 in 93:
NeXT modified their plans of NeXTStep and wanted to redesign it. They wanted it to be portable, to be able to run on any platform. They partnered with Sun Microsystems and created OpenStep 4. OpenStep isn’t an actually OS, it’s an Object oriented API that can use almost any OS as it’s core. Because of OpenStep’s portability Sun Microsystems started seeing it as a competitor to Java.
OpenStep 4.2 on my iBook G4, The program opened is Edit.app:

In 1995, Apple was looking for a new OS for their computers. They were fading away and needed something to revitalize their products, they need a new OS. One of the first they looked at was Windows NT, this OS is now being used with XP and Vista. They didn’t like what they saw, so they continued looking. Then they saw OpenStep 4 and of course, Steve Jobs. By 1996 Apple bought NeXT for $400 million. In 1997 Steve came back to Apple to save it as the iCEO, a company that in 1995, even he thought would die.
“The Macintosh will die in another few years and its really sad. The problem is this: no one at Apple has a clue as to how to create the next Macintosh because no one running any part of Apple was there when the Macintosh was made–or any other product at Apple.” - Steve Jobs, 1995
In July(1997), the last “real” full version of the Mac OS was created, Mac OS 8. This was designed to finish up the Mac OS while Apple continued to develop a new OS using OpenStep. Mac OS 9 was a transitional OS to switch from the Mac OS to Apple’s new OS called Rhapsody 5. The 5 was to continue the version number from NeXTStep. The first version came out at WWDC97 with developer Release 1. It had Openstep at the core with the Mac OS GUI look. Apple released Rhapsody as an OS for Macs and Intel PCs, as well as an API add-on to Windows, Solaris, and Linux.
Rhapsody, commonly called Yellowbox, on Windows.You’ll notice that Apple’s Interface Builder is open, It also has a menu bar at the top:

Apple created three application environments for Rhapsody: bluebox(Mac OS), Yellowbox(OpenStep), and Java. The Windows side of Rhapsody wouldn’t have Bluebox since this was just added for old mac apps that hadn’t been ported yet to Yellowbox. Eventually Apple stopped the development of its OS on Windows and the other platforms, the last release of Rhapsody for windows was Dev release 2. No one fully knows why, but part of the reason was low support from developers at the time. Another aspect that could of added to this was Apple and Microsoft going through disputes at the time.
In 1999 Apple released OS X server 1.0, aka Rhapsody 5.3. By this time Apple renamed Bluebox, classic, and they renamed Yellowbox, Cocoa. The name Cocoa was to make it fit better with the other application environment, Java. Another application environment that was added later was BSD. In 2000 Apple finally shared their new interface they had been working on for sometime, Aqua. This changed the industry look of a graphical user interface, giving it a more real and beautiful look and feel. At the time Steve Jobs showed Aqua, OS X looked similar to NeXTStep, but with a better GUI. To get rid of licensing problems, Apple created Quartz to render the graphics. Quartz uses Pixar’s Renderman technology to composite and render the graphical user interface. It’s imaging Model is very similar to the PDF technology.
This is the what Aqua originally looked like, for some reason they put the Apple icon in the middle of the menu bar:

On March 24th, 2001 Apple finally released OS X 10.0 Cheetah, it still was in beta form, the Darwin OS underneath was at version 0.1. Six months later 10.1 Puma comes out. Darwin then becomes 5.1 with version 10.1.1. Apple started with version 5 after OpenStep 4, this was to override Rhapsody 5. Apple started to make OS X portable again with the release of 10.2 Jaguar. The introduction to this version brought the first version of OSx86, although it was only used internally until Tiger, it showed that Apple was thinking about a processor switch. They were tired of there partners Motorola and IBM(mostly Motorola), who wasn’t advancing fast enough with the Powerpc.
OS X 10.0(2001). The Dock became a transparent strip. This is after thousands of Developer feedbacks(Apple does read them):

At this point OS X 10.5 Leopard uses Darwin 9, which is another words, “Openstep” 8. The classic environment in OS X has faded away through the years, and now is removed from the latest version of OS X. This means the original Mac OS is now completely dead. So what is OS X? Well it derived from an OS, but it is in fact an object-oriented API that rests atop an operating system. The OS it is atop is Darwin, which is built out of a modified version of FreeBSD and Mach. Apple has shown that the portability of OS X is still there. They have so far ported it from PPC to x86 and ARM processors. Darwin is an opensource OS with an open community. it has a few distros with it, including openDarwin. Apple hosts the Darwin project on Macosforge.org.
Although OS X is an API, through the years it has created many deep roots into Darwin, making it less and less portable to other operating systems. There are many people still waiting for Apple to bring back Yellowbox for windows, but most have instead gone to GNUStep(an alternative). GNUStep is similar to Openstep, but is older and still has an active community. GNUStep is a multi-platform developer environment, using objC and a similar API to Cocoa.
iPhone’s OS X:
I’ve read many articles saying OS X on the iPhone is not really OS X, but a stripped down version. Well the truth is, they’re wrong. OS X like I wrote above is an object-oriented API. The reason why OS X looks different on the iPhone than a Mac is the applications used. OS X on a Mac uses programs like the Finder.app and the Dock.app to create it’s GUI, while the iPhone uses it’s own applications.