The two official languages of Mallorca are Castilian Spanish and Catalán. What you hear spoken on the streets between the locals is most likely to be Mallorquí, very similar to the latter.
Catalán was coined from Vulgar Latin in the Pyrenees Mountains between France and Spain and deviated from the other Romance languages in the 9th century. It spread throughout the Iberian Peninsula as the Catalán counts invaded Muslim territory and became the official language of the kingdom of Aragón between 1137 and 1749.
However, throughout history, Catalán has experienced quite severe political suppression which stalled the language’s development. Although it is now a co-official language (with Spanish) in Catalonia, Andorra, Valencia, Sardinia and the Balearic Isles, its use was prohibited as recently as during Franco's dictatorship (1936-1975). Consequently, none of Mallorca's five daily newspapers are written in Catalán and virtually everyone on the island speaks or, at least, understands Castilian Spanish.
Catalán, as well as Mallorquí, have had the freedom to revive in the last few decades. Changes in the Spanish government after Franco led to Balearic territories officially being declared an autonomous community. In 1977, the Generalitat de Catalunya was reinstated and measures were put in place to standardise the modern Catalán language, leading to it being the primary language in education, politics and public life in the areas who choose this language over Castilian Spanish.
You will notice that, in Mallorca, the signposts on the roads are in Catalán rather than Castilian Spanish. The Mallorcans have dealt with and fought off centuries of invasions, as a result, they have become a patriotic island and relish in bringing back some of their history. At the same time, they understand the importance of tourism for their economy and have learned to accommodate their 'visitors', so feel free to choose which language you prefer to use with the locals, they will be equally welcoming!