I leave Harald Hardrada to someone else, but as for William ...
TLDR: Edward the Confessor is thought (it's under dispute by some historians as the only contemporary source we have is the Anglo-Saxon Chronicle) to have promised William the throne of England.
Edward the Confessor (who was at least part Norman) was childless, but knowing that he needed to name a successor, he (allegedly) named his cousin, William of Normandy to be his heir. His choice of William was something of a powerplay against the Godwin family.
Harold Godwinson (of the Godwin family, and future Battle of Hastings key player) was the powerful Earl of Wessex, but a royal pain in the ass to Edward. In 1064, Edward sends Harold over to Normandy to offer William the succession. Whether legitimately, or by trickery (again, sources differ depending on whether they're Norman or English), Harold swore allegiance to William during this interaction. Ironically, Edward had absolutely no right to be offering the throne to anyone as the job of choosing the next king was the job of the Witan (kind of like a cabinet of ministers, wise men, etc. ... check out the Wikipedia article for a really brief overview). Edward was just ticked that Harold (of the aforementioned hated family) was heavily favoured by the Witan... and he was ultimately the Witan's pick.
From the article "Aelred of Rievaulx's Life of St. Edward the Confessor: A Medieval Ideal of Kingship" by John E. Lawyer published in Fides et historia v.31, no.1 (1999)
Harold Godwinson's successful claim to the throne was neither unexpected nor unprecedented, even if he was not of Alfred [the Great]'s line. He was popular and capable; more to the point he was English, and no one else offered comparable prospects for the unity and safety of the realm. Later English sources claimed that Edward bequeathed the kingdom to Harold on his deathbed, in contrast to the official Norman sources which held to the earlier promise of Duke William. As often the case, the political mythology is more important than the face; the claim, whether false or true, underlines Harold's perceived suitability to rule.
Aside: I know that isn't the most recent article, but it does nicely go through Edward the Confessor's reign and all the political machinations (WAY more going on than just what I've mentioned, especially with Scotland and some of how the Vikings all play into this) that eventually lead to the Battle of Hastings in 1066 along with the whos, the whys, and the wheres.
So the question then becomes who had the best claim to the throne, William (anointed by Edward) or Harold (chosen by the Witan)? Honestly, they had about equal claim. William was related by blood and by Norman standards of the time (remember, Edward was part Norman), the King could choose his successor. Harold was properly elected. He had the backing of the people. The only reason William eventually got to sit on that throne (you know, for the, like, five minutes he was in England before heading back to Normandy for the rest of his life) was because Harold died during the battle.
In case you haven't, check out the Bayeux Tapestry, too.
Edit: Spelling
Ok, I'll take a crack at Hardrada, honestly it's rather simple as to why he had a claim, so I don't need to go too in depth. Prior to England being ruled by Edward the Confessor, England was ruled by Scandinavian Kings, one of which, King Cnute (who reigned from 1016 - 1032, was related to Harlald Hardrada.
Because of this, Harald took the opportunity to "reclaim" the land for a Scandinavian king.
This diagram may help.
Also, a fourth claimant existed, which you may already know about, as you only specified the two "foreigners", but for those that may not he was Edgar the Ætheling, the closest living relative of Edward the Confessor. He was proclaimed king after Harolds defeat at Hastings, but was never crowned.