How do they change exactly half of the chromosomes from X to Y?
They can't. They can mutilate her surgically, but she is and will always remain female. Apparently, there are coaches who teach these mutilated people how to better impersonate the opposite gender after they have gone through the physical mutilations--but the behavior will never come naturally to them.
During fetal development, the default developmental pathway is essentially female. The presence of testosterone (from the testes) during that period drives the development of male characteristics, including male brain structures. No amount of surgery can cause those to develop after the fact!