Why did jazz musicians start referring to an engagement as a "gig"?
Solution 1:
The OED says the origin of gig is unknown.
Here's the full entry in A Jazz Lexicon (1964) by Robert S. Gold, which offers a possible etymology and some early quotations (with extra formatting for readability).
gig, n. [poss. from gigue, a lively dance form of Italian origin commonly used as the last movement of a suite (cf. English counterpart jig): from Old French giguer; according to jazzman Eubie Blake, bandleader James Reese Europe used the term in its jazz sense as early as c. 1905; widely current since c. 1920] Initially, see 1955 quot.; since c. 1955, see 1959 quot. (though, it should be noted, for the non-jazz job, the term is applied only to a non-jazzman; for the jazzman, the non-jazz job is a hame or a day gig, q.v. ).
— 1926 Melody Maker, Sep., p. 7. One popular "gig" band makes use of a nicely printed booklet.
—1931 Melody Maker, May, p. 369. Bill Henry and his orchestra were responsible for the undoubted success of half the local gigs.
—1946 Really the Blues, p. 370. gig: single engagement, club date.
—1955 The Encyclopedia of Jazz, p. 346. gig: job (esp. one-night stand).
—1959 The Holy Barbarians, p. 89. He returned to the bass fiddle and started making night club gigs again.
—1959 Newport Jazz Festival: 1959, p. 45. gig: a job of any kind, musical or non-.
Solution 2:
The first documented use of the term "gig" in this way appears in 1926: Melody Maker 7 September 1926, with the story byline stating, "One Popular Gig Band Makes Use of a Nicely Printed Booklet." [1]
As discussed at the link cited, some jazz historians believe that the term originated from a dance called a "gigue," while others believe that the term derived from carriages called "gigs" in New Orleans. The thought is that black musicians, in order to avoid being arrested for playing on the street would instead play jazz on the back of carriages or trucks.
The latter explanation has some support from popular culture. Richard Digance on UK TV Channel 4's Countdown is widely quoted as forwarding the notion that the term derives from black musicians in New Orleans as stated above.
Solution 3:
I'm not sure what to make of the following lengthy slang history of gig from Harold Wentworth & Stuart Flexner, Dictionary of American Slang (1960), but it's certainly interesting and unexpected:
gig n. 1 A child's pacifier or any object, as a cloth square, spoon, or the like, used as a toy; any object to which a small child is attached and with which he likes to play; any object treated by a child as a fetish; a gigi or ju-ju. Orig. Negro slave and Southern use. From "gigi," the word is very well known to about 35% of the population, unheard of by the rest. 2 [sometimes taboo] The rectum. From "gigi." Used euphem. by some children, as part of their bathroom vocabulary, but not common to all children. Used by some male adults [taboo] as a euphem. for "ass" in such expressions as "up your gig." 3 [taboo] The vagina. From "gigi." Not common. Prob. Southern use. 4 A party, a good time; esp. an uninhibited party; occasionally but not often, an amorous session, necking party, or even a sexual orgy between a man and a woman. c1915 [1954]: "Cornet players used to pawn their instruments when there was a lull in funerals, parades, dances, gigs and picnics." L. Armstrong, Satchmo, My Life in New Orleans, 100. 1958: "Life is a Many Splendored Gig," a song title. 5 A jam session ; a jazz party or gathering of jazz musicians or enthusiasts. Orig. swing use. 1920 [1954]: "Kid Ory had some of the finest gigs, especially for the rich white folk." L. Armstrong, Satchmo, My Life in New Orleans, 141. 6 Specif., an engagement or job for a jazz musician or musicians, esp. for a one-night engagement. 1950: "If I ask you to go out on a gig, it's thirty-five or forty dollars for that night." A. Lomax, Mr. Jelly Roll, 204. 1954: "On a gig, or one night stand." L. Armstrong, Satchmo, My Life in New Orleans, 221. 7 Something, as a jazz arrangement, that is satisfying or seems perfect. Orig. swing use. 8 A fishing spear; a pronged fork as used for catching fish, frogs, and the like. 1946: [citation omitted]. 9 An unfavorable report; a demerit; a reprimand. Army and some student use since c1940. The relations, if, any, between a child's pacifier or fetish, the rectum and vagina, a party, a sex orgy, jazz music, a pronged fork, and a reprimand are most interesting, and lie in the field of psychology rather than of etymology.
The second edition of Wentworth & Flexner (1975) repeats this definition word for word, but the the third edition, which is essentially a completely new book, cuts back on the early definitions. From Robert Chapman & Barbara Kipfer, Dictionary of American Slang, third edition (1995):
gig 1 n jazz musicians by about 1915 A party for jazz musicians and devotees; =JAM SESSION [citation (the Kid Ory quote again) omitted] 2 n jazz musicians by about 1905 A playing date or engagement, esp a one-night job [citations omitted] 3 v [citation omitted] 4 n 1950s Any job or occupation [citations omitted] 5 n A criminal act; swindle; =JOB, SCAM [citations omitted] 6 n Armed forces by 1940s A demerit; report of deficiency or breach of rules [origin unknown; musicians' senses are extensions of earlier meanings "spree, dance, party," found by 1777]