We are only just starting to appreciate the full sexual diversity of animals. What we are learning is helping us understand evolution and how animals will cope with a changing world.
In humans and other mammals, sex chromosomes (the Xs and Ys) determine physical sex. But in reptiles, sometimes sex chromosomes do not match physical sex. This is called “sex reversal”. Some species, including snakes, use sex chromosomes like humans do. But in other species, such as crocodiles and marine turtles, sex is determined by the temperature the eggs are raised in.
Read more in this blog from the CSIRO: https://blog.csiro.au/sex-lives-reptiles-leave-vulnerable-climate-change/