It's never been stated either way on screen, but as writer Gareth Roberts once said, "If [regeneration] happens naturally, then it's the weirdest
piece of evolution."
It's probably something that was engineered by Rassilon or Omega (probably the former); indeed the 40th anniversary audio story Zagreus
Cardinal Rassilon had been investigating a method of regenerating decayed and diseased tissue via a series of self-replicating, biogenic molecules. The cells of a Gallifreyan body would be repaired, restored and re-organised, resulting in a wholly new physical form. The brain cells would also be rearranged, though to a lesser extent; the new incarnation would retain the memories of the former incarnation, though the personality of the Time Lord or Lady could change, the degree of this change depending upon the Time Lord or Lady in question. Rassilon intended this mechanism only for the Gallifreyan elite. He also inputted a parameter of twelve regenerative cycles to avoid decaying biogenic molecules.
The fifth Doctor novel The Crystal Bucephalus
states that Time Lords have triple-helix DNA, the third strand being added by Rassilon to enable regeneration.
Then there was A Good Man Goes to War
acknowledging the Untempered Schism as a contributing factor to regeneration.
It's just about possible to reconcile these into a single mythology. Perhaps continued exposure to the Schism over millions of years gave the Time Lords some susceptibility to Rassilon's tinkering; perhaps he was somehow able to harness this energy and use it to his advantage. Melody/River is referred to as a "child of the TARDIS", but we don't know exactly what
her conception within the time vortex exposed her to... lingering biogenic molecules perhaps?