As far as I can remeber, the caves of Granada are associated with the gypsies of the Sacromonte neighborhood.
You can see in the picture on the right hand side the little holes where the caves are in the Sacromonte quarter.
The cave met unbeatable conditions to be the favorite home of the gypsy. On the one hand, the security conferred by its outlying location in the city and, as a consequence, its distance from the authorities in charge of enforcing the law. On the other hand, its cheapness and relative comfort: cool in summer and warm in winter. Thus, the caves emerged for the marginalized, outside the city walls, for what it meant to be outside the administrative control and the ecclesiastical order.
However, the great popularity of caves and gypsies reached its peak with the visit of romantidc travelers of the nineteenth century and has lasted until today.
The cave, since prehistoric times, has been an occasional shelter or permanent-temporary dwelling of human being. It has also been typical of sedentary peoples and sometimes of pastoral peoples, who have occupied them periodically. Generally, the populations that have adopted this type of housing did not have an advanced technology, their poverty was extreme, contenting themselves with simple holes that were adapted to their needs.