The actual wordings in Arabic is
وَإِذَا سَبَقَ مَاءُ الرَّجُلِ مَاءَ الْمَرْأَةِ نَزَعَ الْوَلَدَ،
وَإِذَا سَبَقَ مَاءُ الْمَرْأَةِ نَزَعَتْ
translation given in sunnah.com is
And if a man's discharge proceeded that of the woman, then the child
resembles the father, and if the woman's discharge proceeded that of
the man, then the child resembles the mother." https://sunnah.com/urn/41620
The word used for "proceeded" in Arabic is sabaq (سبق). It can also mean priority or precedence. Actually there is no mention of orgasm as mentioned in your question.
We know if genes in father's sperm takes precedence over genes in mother's ovum than the child resembles father and vice versa. So there is nothing wrong in this hadith from a scientific view.