It's helpful to look at how, when and why the two companies embraced unix.
Apple did it upon Jobs' return, when they were at the point of maximum damage from the Skulley days. Internally, they had in the past looked at various OS alternatives to MacOS but those went nowhere. Jobs got that MacOS was beyond repair, and along with his NeXT experience, saw a bit of light. OS X was launched and the open part of it became the Darwin project. Interestingly, the BSD kernel was abandoned in favor of the Mach kernel, whose source code at the time was quite a mess.
The first open source I'm aware of in Windows was their TCP/IP improvements (back around 2000 or so when networking _really_ started to work well on Windows), stolen whole cloth from BSD without credit. This was strongly denied as re-engineered until someone leaked source and it still had the open source credits in it. Then there was the Microsoft attempt at the Korn shell. Upon its unveiling, an MS wonk stood up and explained how great it was. An old guy in the audience sang out that it violated a number of conventions, and the wonk argued that perhaps the old fart didn't know that ksh was well-known and that blah blah blah. The old fart simply answered,
Yes, I know, my name is David Korn. There was a time when Microsoft had guns blazing for FOSS. But that was then.
The relationships of SuSE(*), Novell, Attachmate, WRQ and Microsoft are dizzying. In a day many of us never thought could come, Microsoft now owns Linux-related patents and to top that off, a small piece of your Android phone was paid to MS.
Apple initially embraced open source to survive. Microsoft did it gain a portion of control of a competitor.
Both seem to have succeeded admirably.
*Footnote - in the early dot com days, SuSE Linux was recognized and certified by the EU for telecommunications, and stories of their phone companies adopting SuSE right and left was a common occurrence on Slashdot. What a coincidence how that all ties to phones, money and control and how interesting things ended up playing out today. Yep - total coincidence. I also have bridges for sale.