early 14c., "an opening in a wall or hedge; a break, a breach," mid-13c. in place names, from Old Norse gap "chasm, empty space," related to gapa "to gape, open the mouth wide," common Proto-Germanic (cognates: Middle Dutch, Dutch gapen, German gaffen "to gape, stare," Swedish gapa, Danish gabe), from PIE root *ghieh- "to yawn, gape, be wide open."
From late 14c. as "a break or opening between mountains;" broader sense "unfilled space or interval, any hiatus or interruption" is from c. 1600. In U.S., common in place names in reference to a deep break or pass in a long mountain chain (especially one that water flows through), a feature in the middle Appalachians.
c. 1300, "kind, sort, class, a class or kind of persons or things sharing certain traits," from Old French gendre, genre "kind, species; character; gender" (12c., Modern French genre), from stem of Latin genus (genitive generis) "race, stock, family; kind, rank, order; species," also "(male or female) sex," from PIE root *gene- "give birth, beget," with derivatives referring to procreation and familial and tribal groups.
Also used in Latin to translate Aristotle's Greek grammatical term genos. The grammatical sense is attested in English from late 14c. The unetymological -d- is a phonetic accretion in Old French (compare sound (n.1)).
The "male-or-female sex" sense is attested in English from early 15c. As sex (n.) took on erotic qualities in 20c., gender came to be the usual English word for "sex of a human being," in which use it was at first regarded as colloquial or humorous. Later often in feminist writing with reference to social attributes as much as biological qualities; this sense first attested 1963. Gender-bender is from 1977, popularized from 1980, with reference to pop star David Bowie.