Sex Reversal in Chickens Kept in Small and Backyard Flocks - eXtension tells us (of chickens):

How does spontaneous sex reversal occur? Typically, a female chicken has only one functional ovary, the left one. The right ovary and oviduct are present in the embryonic stages of all birds but usually do not develop … Most cases of spontaneous sex reversal result from a disease condition that damages the left ovary. … Residual tissue in the right ovary develops in the absence of the functional left ovary. This regenerated right gonad is known as an ovotestis … There are reports of hens with ovotestes producing semen, making them capable of fathering offspring.