I doubt it was "invented to do X" -- that implies too much strategy. Instead, I think it happened because of some historical coincidences, and coincidentally it also happened to do X.
The historical reason for not reproducing was the early Christian belief that the end of the world is near, so it does not make sense to marry and have children. (These days there are some Jehovah Wittnesses who don't have children for these reasons.) Of course most people violated this rule and had sex anyway, but following the rule became a voluntary signal of having strong faith.
A few centuries later Catholic Church realized that if they could make non-reproduction of priests mandatory, all resources that those priests would otherwise gather for their families, would now return to the church ownership. And they already had the excuse that not reproducing was a signal of strong faith, so it made sense to demand the signal from the priests. So the Popes began a campaign against marriage of priests; at the beginning the priests ignored them, but gradually the pressure increased, and at some moment one Pope ordered to take all existing wives and children of priests and sell them to slavery. From that moment, Catholic priests were celibate... at least officially, because unofficially I would guess most of them either have a secret wife and secret children, or secret homosexual relations.
Of course the people who are religious and unattractive can rationalize this and join some institution that requires celibate, thus converting their lower status on sexual marketplace to religious status. On the other hand, there are also many attractive people who choose this role because of their strong religious feelings. -- The fact that many priests actually secretly have sex and children is an evidence of their attractivity. Of course there is this confounding factor whether having high religious status could have made the difference in their attractivity. But I anecdotally know about a few people who were considered attractive before they became celibate for religious reasons.
This thread is for asking any questions that might seem obvious, tangential, silly or what-have-you. Don't be shy, everyone has holes in their knowledge, though the fewer and the smaller we can make them, the better.
Please be respectful of other people's admitting ignorance and don't mock them for it, as they're doing a noble thing.
To any future monthly posters of SQ threads, please remember to add the "stupid_questions" tag.