The situations seem somewhat similar to me in broad respects. The British of the 5th century and the Saxons of the 9th century each were a disparate group of petty kingdoms facing migrating waves of invaders from across the sea--the Saxons themselves in the former period, and the Danes/Norse in the latter.
The Post-Roman British were unable to resist the Saxons and eventually either migrated to Wales and Brittany or were forcibly absorbed by the Saxons. The Saxons themselves, meanwhile, were able to defeat the Danes/Norse and integrated them into the dominant Saxon culture.
Recognizing that reliable records from these periods are sparse, can we say with any level of confidence why one group successfully defended themselves, and the other did not?
I don't think the two situations are that similar beyond the broad strokes and there are several important differences between the two time periods and "invasions".
The migrations into Britain by Germanic peoples at the tail end of the Western Roman Empire and through the early Medieval Period are not an entirely understood phenomenon. In many ways it was anomalous compared to the other migrations that occurred at the same time in that the new Germanic population did supplant the native Latin and Celtic peoples across most of the former province.
Now it is not known exactly how this transfer went about. The 19th century narrative of migrators showing up and slaughtering all of the inhabitants is almost completely discredited, but the debate remains as to how large the numbers of new arrivals were. Historians still debate the scale of population transfer and numbers of the new arrivals and genetic testing has only made the issue even cloudier than before. Historians put estimates on the Germanic make up of Britain's population anywhere from the single digits to wholesale population replacements, with most estimates falling somewhere around 20%. So what does this look like in absolute numbers? Heinrich Härke argues a population of roughly 1 million Britons at the start of the 5th Century and a total migratory population of about 200,000.
Now if there was no mass slaughter of the original inhabitants and the arrivals from continental Germania formed a minority of the population, even if they were now the elites of society, why did the previous inhabitants stop speaking Celtic languages and start speaking Germanic ones? This really is the million dollar question and no historian has managed to come up with an all encompassing answer that is widely accepted.
Peter Heather posits that there was a period of cultural flexibility at the end of the Roman Empire in Britain and that the native people of Britain could have formed a new Germanic identity relatively quickly given the collapse of Roman authority and the sudden influx of Germanic peoples. Now his theory is by no means widely accepted nor is it uncontroversial, but it is one of the few actual theories out there right now that isn't reliant on the wholesale destruction of the native peoples, which almost certainly did not happen.
Heinrich Härke argues for a similar process of cultural assimilation that was relatively rapid, but does not go to the same lengths as Heather to provide explanation for why it happened, merely that it did.
However not all historians and archaeologists support this idea of a relatively large number of arrivals from the continent. Some historians such as Nicholas Higham argue for a much smaller size of Anglo-Saxon arrivals, only some several thousand.
Now for the Norse invasions in the medieval period there is substantially more contemporary sources and evidence. The period in England of "Danish" rule stretches from the late 800's to 1042 (with an attempt by Harald Hardraade of Norway to re-establish Scandinavian rule over England).
What is incredibly important in the early period of this time frame is that the Anglo-Saxon kingdoms of Northumbria, Mercia, and East Anglia were all conquered. Wessex itself was also invaded several times and had to pay tribute to the Danes, but they were never able to establish lasting control over the southern kingdom.
Only Wessex managed to survive and Alfred the Great's literary patronage indicates that he was at least somewhat aware of an idea of "English" as an identity. There was also conscious knowledge that the Danes were not a part of the English nation and were an "other", despite their own subjugation by the kings of Wessex in the late 10th Century.
The Danish rule over England under Cnut the Great was a brief period where this trend was reversed. He collected Danegeld and many of the prominent landowners under him were Scandinavians, but following his death and the deaths of his heirs, most English lords were Anglo-Saxons and this would stay in place until the Norman Conquest.
So really it is erroneous to claim that the Saxons were able to defeat and integrate the Danes and repulse their invasions. Much of England was conquered by them and they remained a potent political force in the area until 1066. Danish kingdoms and rulers remained in power throughout almost this entire time.
Sources:
Heinrich Harke: "Population replacement or acculturation? An archaeological perspective on population and migration in post-Roman Britain."
Peter Heather:* Empire and Barbarians*
Nicholas Higham: Rome, Britain, and the Anglo-Saxons
Angelo Forte et al: Viking Empires
Primary Sources of Note
Bede: History of the English People
Adam of Bremen: History of the Hamburg Church
Anglo-Saxon Chronicle
Sturluson: The Lives of the Norse Kings