First, it's a common misconception that grammatical gender corresponds to real-world gender. This is not really the case. Every boy is une personne (f). Every girl is un ange (m).
That said, for whatever reason, certain words for human beings and animals do have alternative forms according to real-world gender. These are called épicène. Some of them don't change form (un enfant, une enfant). Some of them do (un enseignant, une enseignante).
The words in this group are mostly professions and epithets. In modern times, as more professions have become open to any gender, there has been a corresponding push to make its word épicène. Sometimes this meets backlash from purists.
Popular usage always beats purism in the end when it comes to language, but it does sometimes leave us without an "authority" to dictate the "correct" form. For example, with professeur, is the feminine professeur, professeure, or professeuse ?
In such cases you can consult Google Ngrams or other corpora to see what most people choose and follow that. Or you can hedge your bets, follow what authoritative articles tell you ("ministre is always masculine!") and as a learner people will usually understand you and not give you a hard time.
The second question is easier to answer: a genitive never changes the gender of the main word, i.e. the head. Un groupe de musique is masculine. Une troupe de soldats is feminine.