by 1912, American English, first attested in baseball slang; as a type of music, attested by 1915. Perhaps ultimately from slang jasm(1860) "energy, vitality, spirit," perhaps especially in a woman. This is perhaps from earlier gism in the same sense (1842).
By the end of the 1800s, "gism" meant not only "vitality" but also "virility," leading to the word being used as slang for "semen." But — and this is significant — although a similar evolution happened to the word "jazz," which became slang for the act of sex, that did not happen until 1918 at the earliest. That is, the sexual connotation was not part of the origin of the word, but something added later. [Lewis Porter, "Where Did 'Jazz,' the Word, Come From?" http://wbgo.org Feb. 26, 2018]
Meaning "rubbish, unnecessary talk or ornamentation" is from 1918. Slang all that jazz "et cetera" first recorded 1939. Further observations from Porter's summation of the research:
"Jazz" seems to have originated among white Americans, and the earliest printed uses are in California baseball writing, where it means "lively, energetic." (The word still carries this meaning, as in "Let’s jazz this up!") The earliest known usage occurs on April 2, 1912, in an article discovered by researcher George A. Thompson, and sent to me courtesy of [Professor Gerald ] Cohen.
... By 1915, jazz was being applied to a new kind of music in Chicago. It seems to have been first applied to Tom Brown's all-white band, which hailed from New Orleans. This was followed by many printed references to jazz as a musical style.
1921; see jazz (n.); popularized 1922 in writings of F. Scott Fitzgerald; usually regarded as the years between the end of World War I (1918) and the Stock Market crash of 1929.
We are living in a jazz age of super-accentuated rhythm in all things; in a rhythm that (to "jazz" a word) is super-normal, a rhythm which is the back-flare from the rhythm of a super war. ["Jacobs' Band Monthly," Jan. 1921]