I had to look up the naming system since it seemed backward
In the Welsh naming system, a child was given the father's “given” name as a last name. For example, Owen Powell has a son named John. Ap or ab, meaning “son of,” would be attached, making the son's name John ab Owen.