The Castle of Otranto by Horace Walpole (youngest son of the Robert Walpole, the first British prime minister) was published in 1764 and is universally acknowledged as the first "gothic" novel.* In fact, Walpole subtitled his novel "A GOTHIC STORY."
What I am wondering is, where Walpole got the term "Gothic" that he applied to the story? The book certainly popularized many specific tropes of Gothic literature, which have developed since then and passed on the name to other cultural phenomena that are still prominent, such as the Southern Gothic genre and the goth counterculture.
In the immediate decades after The Castle of Otranto (which was extremely popular), other English-language Gothic fiction were often, like Walpole, set in Italy; for example, the second-most-notable Gothic author in the eighteenth century was probably Ann Radcliffe, who wrote The Mysteries of Udolpho (1794) and The Italian (1797). This suggests that the Italian setting of the The Castle of Otranto—which is set among the (partially Norman) Italian nobility of southern Italy during the time of the crusades—was a key elements in what was felt to be intrinsically "Gothic" about the story. In Walpole's lifetime, long after the end of the high Renaissance and when most of Italy was under foreign (largely Austrian, Spanish, or French) sway, Italy was considered a rather backward place.
There is also the architectural meaning of "Gothic." The word, as applied to the architectural style of late medieval cathedrals, was originally a term of derision coined in the Renaissance, attributing the style to "Goths"—that is, primitive barbarians. However, by Walpole's time, there was a decline in the post-Renaissance neoclassicist esthetic and baroque architecture, and a strong movement toward Romanticism (which was particularly romantic in its fascination with the chivalric pageantry of the Middle Ages). In Walpole's day, the Palace of Westminster (seat of Parliament) was rebuilt in a Romanesque-influence style, and when that burned in the 1834, it was replaced by the equally medieval-looking Gothic revival structure that stands to this day. Although the full nineteenth-century Gothic revival in English architecture was still decades away when Walpole wrote The Castle of Otranto, Romanesque and Gothic styles were definitely coming into fashion. Walpole himself expanded his house at Strawberry Hill in a faux-medieval style (which he called "Gothic" but is really more Romanesque, at least externally).
But what did "a Gothic story" mean to Walpole and his original eighteenth-century readers? Aside from architecture, what elements of the story would have been understood as "Gothic"? Was the Italian setting implied by the term "Gothic" when Walpole used it, or did that association actually arise out of Walpole's use? Was "Gothic" already associated with ghost stories (albeit not ones of full novel length)? Or, perhaps, was it really just the architecture? After all, Walpole, in his fictional prefatory material (supposedly written by the fictional translator William Marshall, who the framing device claims translated the manuscript from the Latin original), takes pains to point out that the narrative contains such a wealth of architectural detail that it must have been based on a real castle. (Apparently, the real castle was just the Strawberry Hill House shown above.) So was "Gothic" just an indication that the story took place in and around a building like the author's "Gothic" mansion, with all the other implications of the term "Gothic" coming later?
*It is sometimes claimed that The Castle of Otrato is actually the first fantasy novel written in English, although this claim is much harder to substantiate. However, from the apologies the author makes for writing a novel with ghosts and magic, it is clear fantasy writing was definitely viewed as unusual at the time.