How infant baptism came to be? In my understanding of church history, it started when Constantine made Christianity the official religion of the Roman empire. A former pagan empire, now to be made Christian. Christianity now a state church, was faced with a huge influx of pagans to be made Christian by baptism.
The state church saw the pragmatic, and much faster, answer to the problem, was to just sprinkle water on them. Once the former, and Biblical, mode of baptism was compromised, it was just a matter of time before they rationalized again, and began to sprinkle infants as their baptism.