Heresy is a deviation from a religious orthodoxy. In this original sense the term can only be used in relation to a religion which is based on a creed or has some other generally accepted method of defining what is orthodox. A heresy is conceived as a distortion of certain beliefs rather than an outright denial, the distortion often being considered as more dangerous than the denial.
The term "heresy" can be applied, by extension, to deviations from other orthodoxies, including the scientific.
The use is normally pejorative. Within the religious sense, a group of people who have succeeded in maintaining their beliefs and practices in the face of the original orthodoxy are usually considered as a branch or sect. The heretics are the unsuccessful.