1540s, "epic poem," also "a book of an epic" (suitable for recitation at one time), from French rhapsodie, from Latin rhapsodia, from Greek rhapsōidia "verse composition, recitation of epic poetry; a book, a lay, a canto," from rhapsōdos "reciter of epic poems," literally "one who stitches or strings songs together," from stem of rhaptein "to stitch, sew, weave" (from PIE root *wer- (2) "to turn, bend") + ōidē "song" (see ode).
According to Beekes, the notion in the Greek word is "originally 'who sews a poem together', referring to the uninterrupted sequence of epic verses as opposed to the strophic compositions of lyrics." William Mure ["Language and Literature of Antient Greece," 1850] writes that the Homeric rhapsōidia "originally applied to the portions of the poems habitually allotted to different performers in the order of recital, afterwards transferred to the twenty-four books, or cantos, into which each work was permanently divided by the Alexandrian grammarians."
The word had various specific or extended senses 16c.-17c., mostly now obsolete or archaic. Among them was "miscellaneous collection, confused mass (of things)," thus "literary work consisting of miscellaneous or disconnected pieces, a rambling composition." This, now obsolete, might be the path of the word to the meaning "an exalted or exaggeratedly enthusiastic expression of sentiment or feeling, speech or writing with more enthusiasm than accuracy or logical connection of ideas" (1630s). The meaning "sprightly musical composition" is recorded by 1850s.