No fish can reproduce immediately after hatching from its egg. Like humans, fish have to mature before they can reproduce.
As a fish matures, hormones are released. These are chemical signals that travel through the blood to the rest of the fish’s body – they stimulate the fish’s reproductive organs to begin to change.
If the fish is to become a female, then the reproductive organs produce fish eggs – as well as other hormones that cause the fish to behave, look, and function as a female. In males, the reproductive organs produce sperm cells – and the fish begins to behave, function, and appear as males do.
In fish that change gender – for example, parrotfish or anemonefish – only parts of the reproductive organs mature at first. The fish lives as a male or a female for awhile.
But – when the fish reaches a certain age, or its mate dies – those initial reproductive organs wither away – and other reproductive organs mature, so that the fish becomes the opposite sex. And what causes the change? The answer is hormones – or chemical messengers in the blood.