I'm not going to teach my boss an important part of my job
Why don't you want to help your boss and teach him?
I think he should learn by himself and it's up to him to keep the information for himself if necessary
He is your boss, and you are under him so it's expected of you to help him out sometimes. It may help you with a promotion as well, so you shouldn't refuse these opportunities.
I thought the best person for the job should be the one doing it and that is me.
It is okay to want to do the work that you are trained for and that you are good at but you should consider that a boss should know all aspects of the job. It would be good of you to help him learn it so that he understands what you do and pays you accordingly.