I'm not an Anglophone, but I think I can answer anyway.
Our surnames are our 'family names' and they mean we belong to a certain family.
Mac or Mc mean 'son of', in this case is 'son of Cain', and in the past it was used only for the boys. As a matter of fact, there was a 'female' surname as well, 'Née', which meant 'daughter of' - e.g. NéeCain, daughter of Cain -, but nowadays it is not used anymore.
This happens with several languages, not only with English - e.g. German, Dutch, Italian and so on.
I hope this can help and, if I'm wrong, someone could correct me.
- For Teachers