These people have a mutation that renders them deficient in the enzyme 5-alpha reductase. Genetically male people with the mutation are born with the physical appearance of baby girls, but with masculinized brains. Although their prenatal testosterone production wasn't enough to masculinize their bodies before birth, the surge of it that accompanies puberty is normally enough to cause belated male genital development, and so you have the spectacle of people appearing to change sex from girls into boys when they reach puberty (although actually they were male all along).
Alpha reductase deficiency (or 5-ARD) is another one of these rare medical conditions that shows that it's hormones, and not whether you have a Y chromosome or not, that determines which sex you develop as. The fact that most people with the condition are comfortable with a male gender identity, despite being raised as girls and having the physical appearance of a girl throughout their childhood, also shows that gender identity is something that you're born with, and that upbringing (and genitals) has little if any influence on it.
There's another article about the same story here:
http://www.canberratimes.com.au/technology/sci-tech/the-village-where-girls-become-boys-at-puberty-20150920-gjqmt0.htmland here's a quote from that article, showing how people with 5-ARD generally have a male gender identity:
QuoteI remember I used to wear a little red dress," he said. "I was born at home instead of in a hospital. They didn't know what sex I was. I went to school and I used to wear my skirt. I never liked to dress as a girl. When they bought me girls toys I never bothered playing with them. All I wanted to do was play with the boys.
Although we tend to think of testosterone as being the primary male hormone, DHT is equally important, as 5-ARD shows. Alpha reductase is the enzyme that converts testosterone into dihydrotestosterone (or DHT), and people with 5-ARD are unable to produce DHT. In all other respects, they're the same as ordinary genetic males, including having normal male testosterone levels.
Androgen receptors in the various different tissues making up the human body, have differing sensitivities to testosterone vs DHT. Those in bone, muscle and (it appears) brain tissue respond well to either testosterone or DHT, whereas those in the genitals, hair follicles and most other tissues that give rise to male secondary sexual characteristics, respond several times more strongly to DHT than they do to testosterone. Testosterone on its own isn't enough to drive male genital development in an unborn baby, and without DHT, genital development initially occurs as female. However, brain tissue is more sensitive to testosterone, and so it does develop as male in people with 5-ARD.
During puberty, testosterone is produced at very high levels for several years, and that is sufficient to finally cause masculinization of the genitals and development of other male secondary sexual characteristics (although as the article I've linked mentions, there are often still subtle differences from ordinary men that persist into adulthood).