Few humans have gone through a sex change. Changing sex in humans is a major effort, involving long-term counselling, surgery and medical treatment. Very few other terrestrial vertebrates, if any, change sex during their life cycle. In contrast, in the underwater world, sex change is very common. And this sex change does not involve any surgery, any hospital stay and any medical treatment. How do marine animals change sex so easily, and why do they change sex in the first hand would be reasonable questions to ask.
First of all, in many animals sex is not determined by chromosomal factors. Thus in many reptiles such as sea turtles the temperature during egg development determines what sex the offspring will have.
In marine systems, non-chromosomal sex determination is mostly a consequence of social rank or, in some cases size, which in itself may be correlated to social rank. Thus most wrasses, basletts and groupers start out as females while large individuals turn into males, while anemone fish start out as males, and, typically, only the largest individual in an anemone changes to being female. In both sex-changing groups, all individuals have both testis and ovaries, but at the most one of those are active at a given time.
Why change sex then. The sex change from female to male is more or less exclusively seen in species where males keep harems or gather in communal mating areas and fight for dominance over females. In such species, it is utterly pointless (with one exception that I get back to in a later blog) to be a small male. As small males do not get any matings, and few individuals reach sized large enough to dominate other males, it makes a lot of sense to start out life as female to ensure participation in the reproduction. Only if an individual for some reason has a better than average life will it reach sizes large enough to change sexes. Such a sex change, when large, will give access to many females and will be very successful in terms of offspring production.
The sex change from male to female does, to my knowledge, only occur in species with strict monogamy. In fish, as in most animals, large individuals will have more excess energy to put into sex cells. As the miniscule sperm cells are cheap to produce, and eggs are many times larger and much more energetically expensive to make, it makes a lot of sense for a monogamous pair to let the larger individual be a female and the smaller a male. Obvious examples of this are the anemone fish, where typically only one individual is a female and at the same time the largest individual in the anemone, while the rest of the resident fish are males. Only when the female dies will the former second largest change sex and become a female.
Finally, some species have no sex determination, but lives life as both sexes. Such animals are called hermaphrodites. A well-known example from land is the common earthworm. The classic example from marine systems is the nudibranchs, where every individual is both male and female. When nudibranchs mate, both partners transfer sperm and both have their eggs fertilized.