The Zanni basically represents the servant, the poor guy in the house, the one who would run and do anything for his master.
The name Zanni comes from "Giovanni", which was (and still is) a very diffused name, in Northern Italy, at least. Carmelo and Nicola in the Southern Italy, among others.
He comes from Bergamo, as much as Arlecchino and all all its "ignorant immigrant spin-offs" ... racism is nothing new, after all.
So it was just the John Doe of the situation - always present, always in charge of something - with supposed diabolic origin, but not really defined personality. Or at least no education, always in need of food or anything else.
The Commedia dell'Arte started out with several Zannis, more or less creating their stage image according to the public feedback, I suppose. Harlequin is one of them, definitely the more succesful one.
And also the real Zanni - the ignorant peasant who comes from Bergamo - is always there on stage, sometimes with his name, sometimes with other names, and it defines more a kind of mask, but not a particular one, although on several occasions he gets the name of Zany Cornetto.