No explanation has been given for this in the TV series. But there is no official "canon" in Doctor Who, so if you choose to incorporate spinoff media like novels or audios into your personal headcanon, the Doctor Who novel Lucifer Rising gave an explanation for the similarity in terms of morphic fields. The idea of morphic (or 'morphogenetic') fields was a real proposal by Rupert Sheldrake (generally seen as fringe science, similar to ESP and such) that there is a sort of force of "habit" in the laws of nature, so for example after one member of a given species learns something, other members of the same species will learn it more easily (the supposed hundredth monkey effect). Sheldrake also imagined morphic fields had a major role to play in shaping the body of a developing embryo, so that this mysterious field would explain the similarity of offspring to parents as much as DNA. [according to the summary on this page, Sheldrake's idea of the role of DNA is that "a newly forming system 'tunes into' a previous system by having within it a 'seed' that resonates with a similar seed in the earlier form. Thus, from this perspective, the DNA in the genes of a living system (like an oak tree) does not carry all the information needed to shape that system, but it can act as a 'tuning seed' that tunes in the morphogenetic fields of previous systems of the same type. Morphogenetic fields are thus the repository of what might be described as genetic habits."]
The Seventh Doctor explains the connection to his companions Ace (the Seventh Doctor's main TV companion) and Bernice (a companion invented for the novels who later appeared in some audios with the Seventh and Eight Doctor, although Eight didn't mention her in his list of past companions in the webisode The Night of the Doctor) on p. 250 of Lucifer Rising, which can be read on google books here:
'I hate to act the dumb brunette,' Bernice said, 'but morphic fields?'
'An interesting, but obscure offshoot of biology,' the Doctor said,
grasping hold of his lapels and leaning forward in his best
lecture-room manner as if nothing else were happening around him,
'first put forward on Earth by a scientist named Sheldrake in the
twentieth century. The theory states that all living beings have a
field associated with them which defines their entire biology, just as
an electric field defines an electron. Humans are the way they are
because there's a morphic field for humans, just as there's a morphic
field for Alpha Centurians and Arcturans and, Rassilon help us,
Daleks, and just as there was one for sparrows and for sheep. Morphic
fields are reinforced by every successive generation, so that human
babies look the way they do because the human morphic field influences
the development of the embryo in the womb.'
He looked over at an astounded Bernice, and smiled briefly, like a
flash of summer lightning.
'And that is why there are so many humanoid races in the universe. The
Gallifreyans evolved first, and thus created a morphic field for
humanoids. That made it more probable that the next race to evolve
would be humanoid, and that made it much more likely that the next
race would be humanoid. The majority of non-humanoid races developed
in environments where two legs, two arms and a head would have been a
For what it's worth, the idea of morphic fields was incorporated into the fourth season of the spinoff show Torchwood, where a change in humanity's morphic field was suggested as an explanation for the strange event of that season, the fact (revealed from the start but I'll put it in spoilers anyway) that
Humanity had suddenly become incapable of dying.
From the transcript of the second episode "Rendition" (the same very minor spoiler as above appears in Jack's last line, so don't read if you want to be 100% unspoiled):
JACK: So is anyone doing investigations on morphic fields?
REX: On the what fields?
JACK: The Sheldrake theory. The passing of connective information
through the process of morphic resonance.
REX: I'm sure it is.
JACK: The theory states that a bunch of monkeys on an island learn how
to use a rock as a knife, then a bunch of monkeys on another island
ten thousand miles away also learn how to use a rock as a knife,
because they're connected through a morphic field.
REX: Come on now, that's just science fiction.
JACK: Except it's not a theory. It's a fact. And the amazing thing
about the Miracle is not that no one's dying, it's not that the human
race has become immortal. It's that it happened to everyone at the
same time. Don't you see? It was instantaneous. And that's a morphic
event on a scale that I have never seen before. So whatever's
happening to this planet, it is massive.
And--I'll put this in spoiler text since it gives a little info about the cause of the mysterious event that the season revolved around--the last episode "The Blood Line" had this dialogue:
REX: So, you found The Blessing and you worked out this morphic
COUSIN: The Blessing exists in a symbiotic relationship with the human
race. It transmits a morphic field around the planet, binding us
together like magnetism, like sunlight.
ESTHER: But finding it wasn't enough. You had to experiment on it.
COUSIN: No, we fed it.
MOTHER: We fed it the blood of an immortal. We had one remarkable
artefact. We found a second remarkable artefact. The combination was
GWEN: So The Blessing absorbed the blood, copied it like a new
template. So, the system changed its setting.
Torchwood never mentioned the idea of a connection between morphic fields and the similarity of humans with Gallifreyans though, so a Doctor Who fan who only wants TV stuff in their headcanon could accept that humans get their traits partially from "morphic fields" without necessarily accepting Sheldrake's idea that morphic fields are reinforced by habit and that the evolution of one species can thereby affect the evolution of a later one on a different planet.