Obviously there is some way that the developing organism is programmed to develop as male or female, but perhaps in some species it is a different chromosome than it is among humans (Homo sapiens or earlier human species).
All mammals I believe. Fish, for example, start out male then turn female. Birds have the sex determining factor from the female rather than the male.