In the medieval period, we see three invasions/migrations to Britain by Germanic groups who all mainly came from Jutland (Cimbria):
Did Anglo-Saxons recognize at that time (at 9th and 11th century) that they are fighting against groups of people that were genetically and culturally related to them?
At least in the TV series "Vikings" King Ecbert mentions that "they [vikings] believe the gods that we once believed in" (or something along those lines). But does this have any historical basis? Did Anglo-Saxons actually understand that ethnic and cultural connection?
The Angles came from and are named after a peninsula in Slesvig/Schleswig. The Jutes came from the peninsula named after them, Jutland, and the Saxons came from primarily Germany and the Netherlands.
There's still doubts about where the Danes derived from, although they were mentioned for the first time in the 7th century as being related to the Swedes and conquering the lands of the Heruli, sometimes thought to be Sjælland. And of course they united during the Viking Age and formed the Kingdom of Denmark.
There's no doubt the languages would've been mutually intelligible, but Vikings were also known for being good at integrating with the current population. That is how the Norman culture came to be. There's also almost no doubt that they wouldn't have realised they shared a common language. Old English actually sounded somewhat similar to what Icelandic and Faroese sounds like today.
Denmark used to have a distinct accent south of the border known as Angelbomål or Angeldanish on the peninsula which is now in Germany, the accent was largely replaced by German and Schleswig Danish over time.