The process is very similar to becoming an editor for a journal.
I was a moderator for the arXiv categories cs.DM and cs.CG for a little over a decade.
At least in computer science, moderators don't have fixed terms of service. New moderators come on board only when new subject categories are created or when an existing moderators steps down. In principle, the advisory board can fire moderators, but I've never seen that happen.
Formally, moderators are chosen by arXiv's scientific advisory board, on the advice of the advisory committee for the category in question. The advisory committee solicits nominations from existing moderators and other experts in the relevant research community. As a general rule, the board looks for active arXiv users who have broad expertise in the topic and strong reputations in the relevant research community, at least at the level of a tenured faculty member in a strong department.
I was nominated (in both categories) by my predecessor (in both categories). My predecessor and the chair of the CS advisory committee asked if I would be willing to serve, I said yes, and that was it.
When I decided to step down, I came up with a short list of candidates in consultation with the steering committees of the most relevant conferences (SODA for cs.DM, SOCG for cs.CG) and a couple of other moderators in nearby areas. I emailed the people at the top of each list, explaining the job and asking if they might be interested. Once I had one willing candidate on each list, I passed the complete lists to the CS advisory committee. They very quickly approved the two willing candidates, they said yes, and that was it.