Anne,
You are trying to establish when John Gallacher moved to Scotland. There are no passenger records for that sort of travel. Folk from Co. Donegal going to Scotland (as tens of thousands did) would mostly have caught the overnight ferry from Londonderry to Glasgow. It usually sailed 3 times a week. It was a short domestic journey and as I say, there are no passenger records for that sort of travel.
The ferry was quite cheap (the main money came from cargo) and folk went back and forth all the time, coming home for weddings and the harvest etc.
The only way you can say when he left is by when he first appears in Scottish records, perhaps in a census or his marriage. Most people went to Scotland because the employment prospects were better there, so it wouldn’t be surprising if he went when he had reached working age ie when he was 16 or 17. Have you found him in the 1851 Scottish census? If not, then he probably hadn’t yet arrived.
You don’t say where and when he married Ellen McGinley but if it was in Scotland and 1855 onwards then the Scottish civil marriage certificate should tell you what John’s father’s occupation was. Also whether he and his wife were both still alive at the date of the marriage. (It’ll say “dcd” after their name if dead). That may help you search for likely deaths in Ireland. Keep an open mind as to spelling. The name may well be Gallagher in Ireland.