As first stated by Giraldus Cambrensis, Merlin of the Historia Regum Britanniae was not the same individual as Myrddin Caledonius. But whereas he stated there were two Merlins in fact there were three.
Gildas’s Ambrosius Aurelianus was known to the Welsh as Emrys Wledig. Geoffrey or a later copyist called him Ambrosius Merlinus. This Merlin was a boy during Gwrtheyrn’s reign and so belonged to gen -2. His father is likely to have been Constantine III. His mother may have been Gwledyr ferch Clydwyn. If so, his name appears in ABT 18d as Amwerydd ap Custennin.
Emrys was the father of Uthr Bendragon and not his brother as claimed by Geoffrey of Monmouth. Also, Geoffrey created a doublet of Emrys by inverting the two Latin elements and thus producing the name for this supposed brother as Aurelius Ambrosius.
The second Merlin was An, the son of a daughter of Helig ap Glannog, see Myrddin Emrys, and consequently of gen. -1. He was the one who articulated the prophecy in HRB VII 3 and was involved in the deception played on Eigr.
The third Merlin is he of the Vita Merlini, known as Myrddin Caledonius, son of Morfryn and king of Dyfed. His sister, Ganieda, was married to Rhydderch Hael who was of gen. 0, see Rhydderch Hael and Rhydderch Hen. He may well have been a contemporary of the adult Arthur, being of gen. 1.
It is generally held that the name Merlin was created to avoid the association with the Latin equivalent of Myrddin, namely Merdinus. However, in reality, the name originated in the HRB as a corruption of Aurelianus.