This is a little known classical Greek transgender myth, facilitated by the Titaness Leto (the mother of the twins Apollo and Artemis, by Zeus, and nemesis of Zeus's wife Hera) who was worshiped as a god of fertility and motherhood, often together with her twin children, and was probably derived from a pre-Greek Anatolian goddess of motherhood.
From Wikipedia citing Antoninus Liberalis, Metamorphoses 17.
In Crete lived a couple, Galatea and Lamprus. When Galatea fell pregnant, Lamprus warned her that if the child turned out to be female, he would expose it. When Galatea gave birth, it proved indeed to be a girl.
Galatea, fearing her husband, lied to him, telling him it was a boy she named Leucippus. But as years passed, Leucippus grew to be an exceptional beautiful girl, and her true sex could not be concealed.
Galatea fled to the temple of Leto, and prayed to the goddess. Leto took pity in mother and child, and changed Leucippus into a boy. To celebrate this, the people at Phaestus sacrificed to Leto Phytia.