How did we become sons and daughters of God?
The short answer is because God said so.
Just like in creation God said, “Let there be light” and there was light, so it was in the waters of our baptism that God said, “You are my beloved child,” and sure enough we were made his beloved daughter or son.
It was nothing we did. And so the ability we have to call God, Father, is a pure gift; the gracious work of God.