"And Dinah the daughter of Leah went out" (Genesis 34:1). Rabbi Hiyya bar Abba said: A male is always ascribed to the woman, and a female to the man. Then why is this one ascribed to her mother? Because the essence of her conception was male. Rather, at the time when Leah had borne six, and Bilhah two, and Zilpah two — behold, ten — Leah had conceived a male. At that moment she prayed on behalf of Rachel, and within her womb it became female. Therefore she is ascribed to her mother: "And Dinah the daughter of Leah went out."
Why Dinah Is Called the Daughter of Leah
Midrash Tanchuma Buber, Vayishlach 18:1
ותצא דינה בת לאה. אמר ר' חייא בר אבא, לעולם הזכר נתלה באשה, והנקבה באיש, ולמה זו תולה באמה, שהיה עיקר עיבורה זכר, אלא בשעת שילדה לאה ששה, ובלהה ב', וזלפה ב', הרי י', עיברה לאה זכר, באותה שעה נתפללה על רחל, ונעשה תוך מעיה נקבה, לפיכך היא נתלה באמה, ותצא דינה בת לאה.