It seems that they might mean the same thing, but in fact we use them in different ways. "on the contrary" is used as a conjunction to express an opposite view or a stronger view, whereas "rather" is used to express a different desire.
John didn't like eating vegetables, on the contrary, he loved eating vegetables.
Betty wasn't ill, on the contrary, she was feeling great.
Mark would rather go to the cinema than the gym.