UCSB Science Line (University of California, Santa Barbara, scientist q/a) claims that:
Long before we are born, the same gonads either become testes, if the embryo has a Y chromosome, or ovaries if it doesn’t. Once that process starts, other changes happen that tell the testes to make sperm and the ovaries to make eggs. There are some rare cases where only one of the gonads gets the message from the Y chromosome, or only part of the gonads gets that message. In that case, an individual can make both eggs and sperm.
However, based on my searches, I haven't been able to find any further support or documentation for this claim. When this was asked on reddit, answers claimed it does not appear there has ever been a documented case, for example.
If what UCSB Science Line claims is true, I'd think it certainly would be documented somewhere. Has there ever been such a case or cases documented?