I'm not asking about the origin of grammatical gender. I am asking where is the earliest example of the term "gender" used to describe classes of nouns. I'm wondering who first decided to name grammatical classes of nouns (and their treatment) as "gender" as opposed, say, to "class 1 nouns" and "class 2 nouns," or something otherwise neutral.
It depends on whether you mean strictly English (since gender is an English word) or do you include the historical antecedents in other languages. The origin of the concept and term is Aristotle in Rhetoric (though Aristotle attributes the idea to Protagoras), and the Greek term is genos, which simply means "kind". It worked its way into French as genre, hence gender in English, attested since 1390 (the non-grammatical sense is attested about 100 years later). Aristotle distinguished grammatical gender and sex gender.
The American Heritage Dictionary of the English Language, Fourth Edition, states the following.
[Middle English gendre, from Old French, kind, gender, from Latin genus, gener-. See genə in Appendix I.]
(Appendix I is PIE roots.) This website: https://www.etymonline.com/word/gender, says that even in Latin "genus" could mean sexual gender, as well as things like "family", "rank", or "species" It's grammatical usage, however, seems to stem from the fact that it was used to translate the Greek word "genos" which Aristotle (and others) used as a grammatical term, and which derived from the same PIE root according to Wiktionary (which says its *ǵenh₁- + *-os = "race, lineage") (Keep in mind that h₁ on Wiktionary is ə₁ in my dictionary because its a reconstructed "laryngeal"; also remember Latin, Greek, and probably PIE all had several inflected forms for nouns.)
My dictionary (Amer. Herit. Dict., 4th Ed.) also implies that the terminology may not have caused as much confusion in English, at least, until "recently."
Usage Note Traditionally, gender has been used primarily to refer to the grammatical categories of "masculine," "feminine", and "neuter," but in recent years the word has become well established in its use to refer to to sex-based categories, ... This usage is supported by the the practice of many anthropologists, who reserve sex for reference to biological categories, while using gender to refer to social or cultural categories. ...
This does leave me wondering when the terms "masculine", "feminine", and "neuter" entered the picture. It is not the result of the Latin term, because Aristotle used it in Rhetoric, Book III, Chapter 5 (Bekker # 1407b)
This website: http://www.perseus.tufts.edu/hopper/text?doc=Perseus%3Atext%3A1999.01.0059%3Abekker%20page%3D1407b, yields this original
to go with this translation I have by W. Rhys Roberts in Brittanica's "Great Books of the Western World".
(4) A fourth rule is to observe Protagoras' classification of nouns into male, female, and inanimate; for these distinctions also must be correctly given. 'Upon her arrival she said her say and departed (ἡ δ᾽ ἐλθοῦσα καὶ διαλεχθεῖσα ᾤχετο).'
(Note the differing section numbers because they're from 2 different sources. Аlso note that the word "genos" (γένος) is in the plural form "geni" (γένη) and is translated as "classification" by WRR., ie. "τὰ γένη τῶν ὀνομάτων" means "the classification [of] the nouns")
Aristotle's example involves an actual female person, but Ancient Greek's gender system applied to other nouns as well. (eg. House and voice are feminine; way is masculine.) At this point it may be prudent to consider that gender systems in many languages, including most European languages actually are somewhat related to sexual gender, both because of the usual alignment of animate (esp. human) examples, and because of metaphor and association. Although Indo-European's feminine gender may have originally come from some grammatical inflexion (Anim.=masc vs Inam.=neut. is prob. older), there is a tendency in many languages to put objects associated with women and with men, or with female and male stereotypes/roles, into different noun classes. There is also research indicating that modern speakers of IE languages (even young children) associate objects that have a certain grammatical gender with the associated sexual gender. https://researchonline.jcu.edu.au/31865/1/31865_Alvanoudi_Pavlidou_2013.pdf It strikes me that this might still have something to do with education, but I don't know if that makes it any less important.
Note that many languages have noun-class systems that relate to real semantic (and grammatical) properties of nouns, such as the complex system of Bantu languages with classes for humans, animals, plants, fluids, actions, etc., or the animate-inanimate (or similar) distinctions of some languages, so it's not surprising to me that gender systems would have some (often very vague) semantic content.
EDIT: According to the World Atlas of Language Structures, most languages with grammatical gender systems have distictions associated with sex, and most of the languages that don't are Niger-Congo languages. (https://wals.info/chapter/31 , https://wals.info/feature/31A#2/-20.6/48.4) The following text was written before I knew that.
Most languages with an actually gender-related noun class system (outside pronouns) are either Indo-European or Afro-Asiatic (like Arabic and Hausa), although it does play an important role in some more complex noun class systems, such as the 4-way noun-class system of Dyirbal (in Australia) which is the inspiration for George Lakoff's book Women, Fire, and Dangerous Things. These previous are the reason why the term noun-class is preferred over gender nowadays, though apparently some linguists distinguish between the two concepts. Here's a link for exploring some of the various types of "genders" in the world: https://en.wikipedia.org/wiki/List_of_languages_by_type_of_grammatical_genders
EDIT2: I'm starting to study Sanskrit on my own, and I've just realized something relevant to this answer:
My claim that Indo-European grammatical gender is indeed related to sexual gender is backed up by the fact that the Sanskrit tradition also uses sexual terminology to describe grammatical gender. (Sanskrit an Indo-European language, clearly related to Greek and Latin.) In Sanskrit, grammatical gender is called liṅga (लिङ्ग). In general, this word means, as Wiktionary puts it, "mark, spot, sign, token, badge, form, emblem, characteristic, representation", but another one of it's more specific uses is to refer to genitalia (a sign of one's sex), and by extension to sexual gender itself. The sexual connection is very weak here, as with Ancient Greek génos (γένος), but, just like in Ancient Greek, it becomes very clear when the names of the 3 genders themselves are given. Masculine, feminine, and neuter are refered to as puṃs (पुंस्), strī (स्त्री), and napuṃsaka (नपुंसक), which have similar sexual implications to the English words "man", "female", and "neuter", resp.
These terms are used in works generally considered to predate Aristotle, and to probably be at least contemporary with Protagoras.* Thus, it seems unlikely to me that they got it from the Greeks, although it's possible, since it's not clear how old these terms are in either culture, and it's probably more likely (though not necessary actually likely) that the Greeks got it from the Indians. I also don't know how old these grammatical concepts are in the thought of Persian or Afroasiatic speakers, who could have influenced both. However, I still think it's quite likely that both Indians and Greeks developed these terms, and thus this association between grammatical gender and sexual gender, independently. If true, this is a sign that this association was intuitive to speakers even before linguistists started using terminology that planted this idea in people's minds.
*Wikipedia estimates that Protagóras lived c. 490 BCE to c. 420 BCE, and Pāṇini, whose Aṣṭādhyāyī regularly uses all 4 of these Sanskrit grammatical terms, is often roughly dated to c. 500 BCE. Wiktionary also claims that "puṃs" is used grammatically in the Śatapatha Brāhmaṇa, which it dates as c. 700 BCE, but I'm not sure if it's really in there in the actual original text. Aristotle (Aristotélēs) is said to have lived from 384-322 BCE, dying shortly after Alexander (Aléxandros) the Great (356-323 BCE), who initiated the first large-scale direct contact between Greek and Indian culture when he invaded India in 327 BCE. According to an uncited claim on Wikipedia, "[t]he Rhetoric was developed by Aristotle during two periods when he was in Athens, the first, from 367–347 BCE (when he was seconded to Plato in the Academy); and the second, from 335–322 BCE (when he was running his own school, the Lyceum)."
Wycliffe was definitely prominent in introducing the use into everyday language
But here may men betere sey in Latein pe sotilte of pis matere, for articlis wi], case, gendre, and noumbre helpen here for to speke.