That's actually complicated, you hit several phonetic and grammar rules at once here.
Kobieta is the most regular – nouns ending with -a after a hard consonant get -y: kobiety. The definition of hard consonants is quite complicated, I'll omit it for now.
Dziewczynka is also regular, but in Polish you never put y after k or g, so it's dziewczynki.
Mężczyzna appears as if it would be mężczyzny, but it's masculine personal noun, which have the following rules for nominative plural:
either add -owie, or
if the final consonant is hard, instead or -y use -i, with appropriate palatalization rules
if the final consonant is not hard, form the plural as usual
Since n is hard, you add -i and get mężczyźni.
There are no hard rules when you use -owie and when -i, so the plural of masculine personal nouns is preferably always remembered.
Chłopiec–chłopcy is simply irregular.
The details would form a several-page long essay, and I don't think this is an appropriate time for that.
Chkopiec/ chlopcy also follows a rule. Masculine animate nouns ending in -iec, -ies, or -ek, lose the ie/e when a case ending is added, so chlopiec -> chlopcy, pies (dog) -> psy, Marek (a man's name -Mark) -> Marki. One would expect 'chlopci', however, it's altered to 'chlopcy' in order to retain the phonetic sound of 'c', rather than 'ci', which is a different phoneme from 'c' and 'i' separately. Remember the written grammar will follow what's spoken (and easier to say), so many things that look weird when written are like that because either it's easier to say, or fits in with how similar forms are spoken. (e.g. in English we have 'an' instead of 'a' for nouns beginning with a vowel because it's difficult to repeat vowel sounds- but remember, it's before a word that starts with a vowel sound, not a written/ letter vowel, i.e. we say 'this is a unique book', not 'an unique', because the 'you' sound (in 'unique') is consonantal, even though it's written as a vowel.