Unfortunately, we really can’t answer that question. Only the person who has made the decision can explain their feelings, motives, etc.
It is possible that your niece has long desired to do this, but fought against it as socially unacceptable. However, as an adult it might now seem acceptable. I have read a few accounts of persons who changed their sex later in life, often stunning friends and family, because they had hid their feelings so long and seemed a model man or woman. However, a point was finally reached in which they couldn’t hold back any longer. Many accounts have stated that the choice was between changing their sex or killing themselves.
Of course, many transsexuals are able to avoid suicide or full transition to the opposite sex. The overwhelming percentage of persons who begin psychological counseling for gender issues find a compromise which allows them to cope. Helping the individual find the path which is right for them is the goal of counseling. It involves weighing all the costs (familial, social, career, financial etc) versus what might realistically be expected with any decision.
Presumably, your niece got such counseling and worked through those issues. But only your niece can explain. We can only make guesses.