This question already has an answer here:
I have read the Geeta but I am unable to understand what exactly is someone's Dharma. If I am an established teacher from a kshatriya varna, is my dharma to teach or to protect/fight in a war? For example, Parshurama was born in a brahmin family but he portrayed himself as a kshatriya. Does that mean he was adharmic? If he wasn't adharmic, then what is the reason for having the caste-system as anyone from any caste can do any occupation as they desire?