Because the traditional reason for census is taxation, voting, or military service, and in those cases you effectively only care about free adult males and count only those.
For example, the original Roman census, from which we take word 'census', registered and counted adult male citizens. They did list their wife, children and slaves as part of extra information about their household, but those dependents weren't part of the census itself, just an "attachment" to the recorded citizen just as the notes about their land and other porperty. Other people like single women or orphans would get reported by their guardians, but they as well explicitly weren't included in the "count of heads", which counts only adult male citizens i.e. those who can run households and own property, be recruited to fight, pay taxes, and vote.
In effect, the ancient world doesn't really consider persons or individuals, they care about households (represented by a single individual) and so register and count those.