English has been spoken in Scotland just a long as in England. The Angles and Saxons arrived in the British Isles sometime before the concepts of Scotland and England existed as countries. They settled in Southeastern Scotland, in areas such as Fife and down through the borders to Northumberland.
In Scotland, the Anglo-Saxon tongue first replaced the old Britonnique languages that were similar to modern-day Welsh and used throughout southern Scotland. As the Old English spread through central Scotland, and as the nation began to form into one political entity, the language spread to the west and displaced the last vestiges of Old Norse that were spoken there.
Two branches of the original Scottish Anglo-Saxon developed. The first was Old Scots, as used by Burns. This is similar to Middle English like that of Geoffrey Chaucer. Later there came Scots English, which many think of as English with a Scottish accent but is, in fact, native to Scotland but more heavily influenced by modern English.
Gaelic, as used in the Highlands, was more similar to Irish and it lasted another thousand years. It was with the 18th-century clearances plus the introduction of mass standardised education, that Gaelic fell into decline.