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 is coming 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.
So it was just the John Doe of the situation - always present always in chanrge of something - with supposed diabolic origin, but no 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 with time.
Harlequin is one of those.
And also the real Zanni - the ignorant peasant who comes from Bergamo - is there on stage, sometimes with his name, sometimes with others, and it defines more a kind of mask, but not a particular one, although on several occasions he gets the name of Zany Cornetto.