The distinction between clergy and everyone else was not given all at once. The earliest Christian writings describe a handful of functions rather than a settled class: the Didache, probably written in the late first or early second century, still speaks of travelling apostles and prophets alongside local, appointed bishops and deacons, as though the settled offices had not yet won out.
By the time Ignatius of Antioch wrote his letters around the year 110, the threefold pattern of bishop, presbyter and deacon was treated as the norm a healthy church should follow, and it is this pattern, not any single office, that later ages contracted into the single word clergy. The decisive change was legal rather than theological: after Constantine's toleration of Christianity in the early fourth century, the empire began extending real privileges to clergy as a recognized class, including exemption from certain civic duties and taxes, which gave the boundary between clergy and laity practical consequences it had not carried before. Other traditions drew the same line by different routes and to different degrees: rabbinic Judaism developed ordination, semikhah, as a chain of authorization rather than a sacrament; Buddhist monastic ordination created a sangha set apart by vows rather than office; and Sunni Islam never formalized an ordained clergy at all, so that its scholars, the ulama, hold authority by learning and recognition rather than by rite.