It's the same Latin root where we get "grotto." The derivation traces back to the accidental discovery in the late 15th century of elaborately decorated underground rooms from the ancient Roman times. According to Wikipedia:
The "caves" were in fact rooms and corridors of the Domus Aurea, the unfinished palace complex started by Nero after the Great Fire of Rome in AD 64, which had become overgrown and buried, until they were broken into again, mostly from above. Spreading from Italian to the other European languages, the term was long used largely interchangeably with arabesque and moresque for types of decorative patterns using curving foliage elements.