The word “groovy” originates in jazz slang, referring to music that’s swinging, tight, funky, in the pocket. The analogy is to the groove in a vinyl record — the musicians are so together that it’s like they’re the needle guided by the groove.
The “groove” becomes generalized to any good rhythm, passage, or entire piece of music; “grooving” means making music well, and the adjective “groovy” follows.
From the Online Etymology Dictionary:
1937, Amer.Eng., in slang sense of “first-rate, excellent;” from jazz slang phrase in the groove (1932) “performing well (without grandstanding)”
The generalized sense of “groovy” meaning “cool” might be kind of dated, but among musicians the groove remains a term of art. For example, see my post on how to groove.