According to one legend, the tapas tradition in Spain began when the King of Spain, Alfonso XIII, visited a tavern in the town of Ventorillo del Chato in the province of Cádiz, and ordered a glass of sherry. On this particular day there was a gusty wind, so the innkeeper served him his glass of sherry covered by a slice of ham supposedly to prevent the sherry from getting dirty but more likely because he didn’t want to have his head cut off!
The King finished the sherry and ate the ham, and when he asked for a second glass, he requested another tapa or ‘cover’ just like the first. This evolved into the practice of using slices of bread or meat as a practical measure meant to prevent fruit flies from hovering over the drink. The meat used to cover the sherry was normally ham or chorizo, which are both very salty and activate thirst and because of this, bartenders and bodega owners began creating a variety of snacks to serve with sherry but, more importantly, increasing their alcohol sales as a consequence.
There are alternative stories about the origin of tapas but so far this is my favourite.