If you can see past that, you will see that Mr Musk is acting in his own interests and the interests of humanity as a whole at the same time. He is giving away the patents to help create a marketplace he can compete in, he is also giving away the patents because he feels that this will help humanity.
There is nothing wrong with either approach really, just a balance that needs to be struck between them.
This balance is what the media distorts, it creates a drama where the figurehead is 'good' or 'bad'. The truth is that no one is entirely either, but their actions can be.