女の子 literally means "female child", thus girl. Despite the hiragana in the middle, it's already one solid word, always pronounced as おんなのこ{LHHLL}. The same applies to 男の子 (boy, おとこのこ{LHHLL}).
On the other hand, 子【し】 in 女子【じょし】 doesn't mean "child". The kanji here roughly means "one (who —)" (In Chinese, 男 and 女 are adjectives and not nouns, so when you refer to a man or woman you need something to make them into nouns). This usage of 子 in other than 男子 and 女子 is mostly archaic, only occasionally seen in bookish writing style, such as 「読書子に寄す」 or 「雲白く遊子悲しむ」.
In modern settings, 男子 and 女子 are often used in the school or sports, which may lead you into the impression that they suggest "young" men or women, but there isn't really such a thing (as we say 男子トイレ or 女子更衣室 for young and old). The nuance around the words is more like "mankind" and "womankind" as opposed to each other, or something like "male member" and "female member".
PS
女子 actually also has a reading おなご, an old-fashioned and/or rustic sounding word for girl, or lassie.