What would happen if Apple released macOS (OS X) as open source?
Most of the software on which OS X is built is already open sourced. What Apple brings to the party is the user experience on top of that software. Since that is where the value is, that will never happen. But since you didn't ask whether it would happen, I'll take a stab at directly answering your question.
In the 1990's Apple struggled to compete with PCs and decided "if you can't beat 'em, join 'em" and licensed their proprietary hardware and software. It was a disaster. Companies struggled to make cheaper Macs while Apple competed with them in some models and kept to the higher end in others. The overall user experience suffered because some of the Mac clones (as they called them) looked exactly like PCs until you turned them on.
If Apple open sourced OS X the overall user experience would decline. People would start installing OS X on their PCs — which would initially be a good thing — until those PCs started getting viruses because Apple no longer had control over the security of the OS. At that point, people who didn't know any better would think the version of OS X shipped by Apple is also susceptible to viruses, and it would be the beginning of the end for Apple.
If this helped you, consider buying me a slice of pizza to help keep the site running. If this solved a big problem for you, consider buying me the whole pie!
Need help with this?
I help people in New Orleans and online with Apple gear, websites and more. Contact me or see more answers in the Knowledgebase.