Quenya was the native language of the first and second tribes of the Elves, the Vanyar and the Noldor. This language was widely spoken in Valinor and was brought to Middle Earth by the Noldor. As Tolkien described it in the The Lord of the Rings Appendix F:
Of the Eldarin tongues two are found in this book: the High-elven or Quenya, and the Grey-elven or Sindarin. The High-elven was an ancient tongue of Eldamar beyond the Sea, the first to be recorded in writing. It was no longer a birth-tongue, but had become, as it were, an “Elven-latin”, still used for ceremony, and for high matters of lore and song, by the High Elves, who had returned in exile to Middle-earth at the end of the First Age (LotR/1127-8).
By the Third Age of Middle Earth, Quenya was effectively a dead language, preserved more or less in the form it had in the First Age. It was no longer spoken in daily life by any of the Elves of Middle Earth, including those few Noldor (such as Galadriel) who remained in those lands. This was the result of a dictate by Thingol back in the First Age, who forbade the use of Quenya after he learned of the Kinslaying at Alqualonde:
Never again in my ears shall be heard the tongue of those who slew my kin in Alqualondë! Nor in all my realm shall it be openly spoken, while my power endures. All the Sindar shall hear my command that they shall neither speak with the tongue of the Noldor nor answer to it (S/129).
This practice of avoiding Quenya spread throughout Beleriand including realms ruled by the Noldor, and it gradually ceased to function as a “native language” for new Elvish children, even those of Noldorin birth. Despite this, Quenya was still used in Middle Earth down into the Third Age. As the first language with a system of writing, there was an extensive literary tradition in Quenya, more so than in other Elvish languages (LR/193). As such, Quenya remained the language of scholars, and in this use it spread to Men as well, especially the Númenoreans. Quenya was also a language of ritual, presumably in traditions taken from Valinor. In this respect Quenya functioned much as Latin did in Medieval Europe, prominent in academics and religion, and Tolkien often called the language “Elf-Latin”.
As a prestige language, Quenya was regularly used in naming important people and places. Númenorian and Gondorian kings often took names in Quenya, versus more ordinary folk whose names tended to be in Sindarin, Adûnaic or Westron. In Peter Jackon’s Lord of the Rings movies, Quenya was used as the language of magic by the Istari, though there is no indication that Tolkien himself used the language that way; the only spoken “spell” appearing in any of Tolkien’s book was in Sindarin (LotR/299). And presumably Quenya was still spoken in the Uttermost West, though what changes it may have undergone in the intervening millenia (if any) isn’t entirely clear.