A clear example of this is in the medieval chivalric story, the Roman de Silence. For those of you unfamiliar with it, Silence tells the story of a heroic person who is born female and assigned female by “Nature” but who decides to live as a man after consultation with the forces of “Nurture” and “Reason.”
In this article Gabrielle Bychowski also tells the story about Eleanor Rykener, a sex worker who was recognized as a woman, in spite of having lived as a man.
Then there is St.Marinos:
According to tradition, passed down through story, relics, and shrines, Marinos was assigned female at birth but chose to enter a monastery and live as a monk.
Ironically, Marinos was ejected from the monastery for a time, because it was believed that he possessed a penis—and that he used it to impregnate a local girl!
Father in heaven, who did miracles for our ancestors with fire and water, You changed the fire of Chaldees so it would not burn hot, You changed Dina in the womb of her mother to a girl, You changed the staff to a snake before a million eyes, You changed [Moses’] hand to [leprous] white and the sea to dry land. In the desert you turned rock to water, hard flint to a fountain. Who would then turn me from a man to woman? Were I only to have merited this, being so graced by your goodness…