Apple is not immune to viruses or hacking. I have experienced both. I recently checked my users file and had two new strangers there. (I had visited a peer to peer file swapping site.) Years ago, OS 7.5 I think, I had a self replicating virus and before I knew it it had used up so much of my memory I couldn't even empty the trash. Had to erase the disk and start over. Even now Norton will occasionally detect something and either fix it or isolate it.
It is natural that the more the Mac operating system resembles Windows or Unix that it will experience the same vulnerabilities in the areas of commonality.