Certain musical jobs and instruments are stereotyped by gender because they fit with our stereotypes about what it means to be male or female in our society.
For example, the role of lead guitarist in a rock band is very much stereotyped as a male role. There have been very few women (Joan Jett, Ann Wilson at times) who have occupied this role for prominent groups. This role fits very much with our masculine stereotypes because it is a very aggressive role. The lead guitarist in a rock band tends to play very hard-edged solos that seem forceful and masculine. (The same goes for drumming in a rock group.)
By contrast, the flute is an instrument that is stereotyped as a female instrument (great male players such as James Galway notwithstanding). This is because the flute makes a much more delicate sound than many other instruments. The sound of a flute seems almost dainty and therefore we see it as a feminine instrument.
Thus, we assign certain instruments or musical jobs to certain genders because they seem to fit our views of what it means to be masculine or feminine.