"device for catching and retaining," especially "a fastening for a door," late 13c., probably from latch (v.).
"machine for separating cotton from seeds," 1796, American English, used earlier of other machineries, especially of war or torture, from Middle English gin "ingenious device, contrivance" (c. 1200), from Old French gin "machine, device, scheme," shortened form of engin (see engine). The verb in this sense is recorded from 1789. Related: Ginned; ginning. Middle English had ginful "ingenious, crafty; guileful, treacherous" (c. 1300).
"device for connecting computers and electronic musical instruments," 1983, acronym for Musical Instrument Digital Interface.