If Scottish Gaelic died out within the elite, why did this happen? Was it cultural influence from England?
I come at this from the angle of Older Scots literary studies, which means I can really only provide some of the picture. If you’re interested in looking further, a good place to start might be Older Scots Literature, ed. Mapstone (2005), or the archive of Studies in Scottish Literature, which is freely available online.
The first thing to note is that getting an accurate sense of the literary landscape of medieval Scotland is a rather thornier matter than that of England. Many of our most important sources for Older Scots literature are sixteenth-century compilations of fifteenth-century texts: the Bannatyne Manuscript, the Asloan Manuscript, the Maitland Folio, and early prints by Chepman and Myllar. Indeed, some Scots texts come in part from English witnesses, such as Copland’s 1553 print of Gavin Douglas’ Eneados, or Thynne’s 1532 inclusion of Henryson’s Testament of Cresseid in his collected Chaucer print. The Old Scots literary tradition “begins”, in a sense, with Barbour’s Bruce, written c.1375, but there is little doubt among scholars that texts predating this composition may have been lost, or have circulated only as oral works.
The artificial “lateness” of the manuscript and print corpus does much to obscure the interaction of Gaelic with Older Scots, at least in the literary tradition. Anglophone influence on southern Scotland had already begun to push Gaelic toward the Highlands by the fourteenth century. The written literature (and therefore the literature that could survive to reach us) was, in Scotland as in England, largely produced for the upper and emerging middle classes, a section of society with increasing appetite for what we might – with great qualification – call Chaucerian verse. The monolithic idea of the “The Scots Chaucerians” has rightly started to fall out of favour with scholars; the great makars of fifteenth-century Scotland (Dunbar, Henryson, Douglas, etc) certainly read and responded to Chaucer, Lydgate and the like, but it would be massively over-simplistic to suggest that the entire Scots tradition can be traced back to the English one. What cannot really be denied, however, is that the majority of written literature being consumed by the elite in Scotland in the fifteenth century is in the Scots dialect rather than Gaelic, and I think that does owe something to the spreading influence of Chaucer, Lydgate etc. on Scottish literary tastes.
An interesting example here is that of King James I of Scotland, the (probable!) writer of The Kingis Quair. James was captured in 1406 (around the age of 12) and became a prisoner at the English court of Henry IV and V, until the regency of Henry VI arranged his release in 1423. He would have had considerable exposure to English court and literary culture during his period as enforced guest (a number of scholars have been unable to resist referring to him as a member of “Chaucer’s captive audience”), and he later married the English Joan Beaufort (coincidentally Chaucer’s grandniece by marriage). James’ The Kingis Quair is an ingenious and often imaginatively daring work of Chaucerian pastiche, and shows the direct influence of Troilus and Criseyde. The manuscript in which it survives, BodL Arch. Selden B.24, testifies to synthesis that was going on in elite Scots literary culture in the fifteenth century – it contains English and Older Scots works side by side, and its compilation brings out many of the stylistic resonances between them.
Gaelic doesn’t seem to have admitted much prestige in this literary milieu, in which English laureate poetry and southern Scots court culture were probably the driving influences. This cultural hostility occasionally manifests in Older Scots poetry itself. Richard Holland’s Buke of the Howlat (composed c.1445–52), best edited in Bawcutt and Riddy, Longer Scottish Poems, vol. I (1987), is a dream vision about the misfortunes of an overproud owlet at the court of birds; it owes its story to Odo of Cheriton, but Chaucer’s Parliament of Fowls probably played a part too. At one point (lines 794–845) as part of a rowdy bit of court entertainment, a rook characterised as “a bard owt of Irland” (Irish and Scots Gaelic had a degree of overlap in this period) sounds off a string of cod-Gaelic mixed with broken Scots that critics still disagree as to the meaning of. I won’t venture to interpret the speech itself, but what follows is interesting. He refuses be interrupted (“wald let for no man / To speike quhill he spokin had”), mercilessly harangues the raven dean when he asks him to behave himself in the company of the noble birds (“Bad him his lesingis leif befor thai lordingis”), and is then roughed up by the other birds while the nobles laugh from above (“The lordis leuch apon loft”). Suddenly they all make up and sit down, and it remains unclear whether the violence was part of the rook’s jesting performance or not – Holland is a genius at using the short “wheel” of his alliterative stanza to fold narrative events economically away.
This says a fair bit about the perceived status of Gaelic in elite Scots literary culture in the later medieval period. Nor is it a unique example; I don’t have an edition to hand to quote, but Dunbar’s Flytyng of Kennedy (a sort of medieval poetic rap battle) includes some similar snobbery about Kennedy’s Carrick origins and “Erschry” (Irish, meaning Gaelic) turns of phrase. Clearly Richard Holland didn’t speak Gaelic, but could mock-perform it (Chaucer pulls a similar trick with some Northern students in The Reeve’s Tale). He ties Gaelic up with a descent from high style to low, from decorum to chaos, from nobility to peasantry. It’s a moment of great fun in the poem, but fun had at the expense of those for whom the poem wasn’t written.
This account is necessarily something of a sketch, and a simplistic one at that. It would be wrong to assume that Scots medieval literary culture was homogenous. Cokelbie Sow, an indescribably weird and fantastic poem of the late fifteenth century, has a similar knockabout scene which (if memory serves) includes some less obviously pointed Gaelic. The Book of the Dean of Lismore (c.1512–42) anthologises Gaelic verse, which suggests at least some literate people had a taste for it. Much of this material (which I confess I don’t know a great deal about) has a bardic, lyric quality – how much was circulating in oral form far later than the written record can show is hard to say. Lastly, I’d just like to reiterate my sentiment that seeing Older Scots literature as a primarily “English” literary tradition, or as one in which English somehow usurped a somehow “genuinely” Scottish Gaelic tradition, would be a misreading. Older Scots literature has a singularity, vibrancy and originality all of its own, and if the perspective I’ve taken to answer this question has done anything to obscure that then the fault lies with me.
/u/Lewed_Losel has already answered as to how the Anglo-Scottish élite felt about Gaelic (which, safe to say, was a strongly negative view), but the Gaelic élite were a different story.
As mentioned in the other response, the Irish Gaelic and Scottish Gaelic literary tradition was closely tied in the Late Medieval period, though less so in the Early Modern. Bardic schools were primarily located in Ireland, and Scottish Gaels would travel there to learn the sophisticated stylings of bardic poetry (of note here, the bards/poets had a larger role than the English word now conveys, holding a role akin to tradition-bearer and historian seanchaidh or philosopher and counsellor ollamh, and were very prominently placed in Medieval Gaelic society.).
You are correct as well that the transition from Gaelic to English among the native Gaelic aristocracy came about due to English influence in Scotland, and had already begun in the Late Medieval period. It did not complete until approximately the middle 18th century, with many prominent Jacobite commanders (and some Hanoverian ones) known to have spoken it. Donald Cameron of Lochiel was known as Dòmhnall Bàn mac Dòmhnall Dubh in the language, for example, and poet Alasdair Mac Mhaighstir Alasdair was responsible for tutoring Prince Charles Edward Stuart in it.
Further information can be found in Ch. 3 of Michael Newton's book, Warriors of the Word: Inside the World of the Scottish Highlanders. Unfortunately, I'm reasonably certain this book is now out of print, but it is absolutely the best book for questions of Gaelic history if you can get your hands on it.