This is also why it's only possible for lesbian couples to have a female baby when they use stem cells to conceive. All cells have your genetic information, so you can trick an egg cell into thinking some other type of cell is a sperm cell. Chromosomes are inherited, so no father means no Y chromosome.
All genetic traits are basically a coin toss if the parents have the necessary genotypes. This is why two parents with brown hair can have a baby who is blonde or red-headed. Children of biracial couples in particular vary widely in terms of appearance. For instance, these two women are twins:
View attachment 1616934
In short,
everything is inherited, but which trait you inherit is basically random. There is nothing that makes trying to switch sexes any less insane than trying to switch races, because brains don't have sexes or races. Those traits are physiologically present at birth, and the mental differences that appear later on are just a result of social conditioning.