Apostasy is a term used in a religious context, for leaving one's religion. Usually it means moving to another religion.
Someone who does this is called an apostate. Apostasy is different from heresy: A heretic only questions one (or more) of the traditions and beliefs of their religion. An apostate questions all of them. The word was first used in Christianity: In the Roman Catholic Church the punishment for apostasy is excommunication. Today, the word isused mostly in the context of apostasy in Islam.