Saint Rule, also often called Saint Regulus, lived from about 300 to about 360. According to legend he was a Greek bishop who in 345 fled from Greece to Scotland with some of the bones of Saint Andrew and, on arrival in 347, built a church to venerate St Andrew that later became the focus of what is now the town of St Andrews. The wider picture in Scotland at the time is set out in our Historical Timeline.
We tell the slightly more historically convincing story of the association of Saint Andrew with St Andrews below, but for the moment let's focus on St Regulus or St Rule. In the 340s he was a bishop in the Greek city of Patras. In 345 he was told by an angel in a dream that the Roman Emperor Constantine the Great was about to move the relics of St Andrew, one of the twelve apostles, from Patras where they were kept to Constantinople. The angel instructed Rule to take as many of St Andrew's bones as he could to the far western ends of the earth in order to protect them from Constantine.
Rule set sail for the west with a number of followers, who - to add legend upon legend - are said to have included the holy virgin Triduana, who would herself later become better known as Saint Triduana. Having exited the Mediterranean and turned right, Rule and his followers eventually found themselves off what is now Scotland, where they were shipwrecked in 347. The site of the shipwreck is said to have been near what is now the harbour of St Andrews, a place that at the time was under Pictish control and known as Kilrimont or Cennrígmonaid. He is said to have arrived with three fingers of Saint Andrew's right hand, the upper bone of an arm, one kneecap, and one of his teeth. According to legend, Rule was welcomed by Pictish King Óengus I (which is odd as he was king in the mid-700s) and established a church in what is now St Andrews dedicated to St Andrew and housing his relics. St Rule's name features widely in modern St Andrews, most notable in the distinctive shape of St Rule's Tower.
An alternative view is that St Andrew's relics were brought to St Andrews by St Acca, who had been Bishop of Hexham until his exile in 732. On this interpretation, St Rule's involvement (and, perhaps, his very existence) was probably invoked (i.e. invented) to make it appear to early Christians that St Andrew's relics arrived in St Andrews much earlier than they actually did (always assuming, of course, that the bones brought by Bishop Acca to the town were really relics of St Andrew). This backdating of St Andrew's credentials by nearly 400 years probably helped win the much later argument about who should be the patron saint of Scotland at a time when many in the Church believed that St Columba and not St Andrew should be accorded the honour.