Changing your gender was not possible before few years but now medical advancement have made it a possibility. Sheikh Saalih received a question that whether it was possible for man or woman to change his gender?
Sheikh answered that we should be pleased with what Allah has made us and changing our gender to please our whims is an evil act and whisper of shaitan which should be avoided. He further explained that changing our gender medically may change us but physiologically we will remain how we were before, so it may further create more problems for us mentally.
But for people who are born with problems physically such as transgender then they can go through such operation, but it will be not called a gender changing operation rather doctors performs the operation to make the hidden genitals appear.
Such operation for transgender is allowed because it is a medical treatment rather than changing gender.