There's a sea separating them and the rest of Scandinavia, but they're connected to Germany by land. Why are they Scandinavian and relatively not very German?
The answer to that lies in the focus of the political and historical centres of both cultural regions.
First of all, these cultural regions we are talking about are very diverse. The Scandinavian centre of power was in medieval times clearly in Danish hands. The interactions with the other Scandinavian nations were diverse, but Norwegian and Swedish cultures were more peripheral until the Swedish crown got a very dominant role in the 16-17 century, were Swedish kings even ruled big regions of Northern Germany. But before the 15th century the Danish kings exerted power deep into regions that are now German. Even now Denmark and Schleswig-Holstein (The most northern County of Germany) have a treaty for politically recognizing their respective minorities. The austro-prussian war against Denmark in the 1860s changed these borders into the modern ones.
Northern Germany had multiple languages and cultural groups that were pretty diverse from southern Germany (Fresian and also lower German languages are genetically more related to English than to southern German). One should not forget that the political centre of the Holy Roman Empire was more in the south, even in regions we now recognize as Northern Italy. In Northern Germany multiple German counties ruled over a very diverse population and were pretty much alone in dealing with the Danish crown. Political borders were very fluent.
Also, there is a very strong influence of lower german into Scandinavian languages, especially Swedish. These influences were exerted through the Hanse as the economical powerhouse of Northern Europe that were linguistically lower German. These influences through trade were achieved through the Baltic sea, the medieval land routes were more dangerous and expensive, especially in the diverse political landscape of the northern German empire.
Even minding that, in Denmark the nobility pretty much spoke only german until the nationalization in the 19. century.
First, I'll explain why crossing the straits in Denmark is not a very big deal, then I'll explain how scandinavian culture came to differentiate itself from german culture.
##Why the straits of Denmark are not major barriers to cross
Historically, the sound of Øresund/Öresund (between sweden and Denmark) has been far from an impassable barrier. It is only 4 kilometers (2.5 miles) at its narrowest, making it easy to cross by boat and for a good swimmer even plausible to swim across.
It also often freezes over in the winter, making crossings even easier.
Even moose occasionally cross the strait, which always gets media attention as there are usually no wild moose in Denmark.
The other Danish islands are also relatively easy to cross. During the March Across the Belts swedish King Karl X took his army over the ice from Jutland/Jylland (the peninsula connected to germany), first occupying Funen/Fyn via "the Little Belt", and then marching onto Zealand/Sjælland/Själland via "the Great Belt", where the capital of Copenhagen lies.
That means that by just crossing three straits — the Little Belt, the Great Belt, and Øresund, you can walk from Germany to Sweden. You can even make the crossing without boats in a good winter.
In short, the water between Sweden and Denmark are not major barriers.
In fact, the historical kingdom of Denmark contained parts of modern day Sweden, as you can see here.
##How Denmark ended up Scandinavian rather than German
The ancestors of the modern Germanic and Indo-European culture in Scandinavia were known as the "Battle-Axe Culture" and arrived around 3000 BC.
Even Denmark was considered a far north frontier back then, but there exists one export that we can trace already this early: amber. Amber from Scandinavia has been found in phoenician graves from the bronze age, and even in Egypt.
Jumping ahead a bit, two germanic tribes from Jutland; the Cimbri and the Teutons, fought Rome in the Cimbrian War, inflicting some of the worst losses since the Punic War before ultimately being defeated.
As Rome entered the Iron age, only a few mentions of Scandinavia exist. This would have been during a relatively cold period in global climate, so it is likely that Scandinavia would have been harsher than usual to live in. There do exist some mentions of Suiones (swedes) and Gautoi (geats) during this time though.
As the Germanic peoples entered the iron age, the first mention of the Danes comes, and these were apparently of the same people as the Suetidi/Suehans (Swedes), having displaced the Herul people.
It is always risky to speculate, but I would like to claim that if the Danes had not displaced the Heruli, then it is plausible that modern day Denmark would be more Germanic than Scandinavian.
By the time the viking age had arrived, there were Scandinavians in Denmark, Sweden as far north as Uppland, and Norway as far north as Oslo.
Denmark, as the most southerly part of Scandinavia, was the most hospitable climate, and also controlled trade from the Baltic sea, making them a very important centre, economically and politically, for the Scandinavian peoples. During the late viking age the North Sea Empire had its capital in Denmark, as did the later Kalmar Union, both representing a sort of Scandinavian unification.
The Carolingian Empire never conquered Denmark, and when the Holy Roman Empire emerged, one of their frontiers was, once again, the border with Denmark.
Thanks to their important position in trade and their occasionally important position in politics, Denmark, despite seeming like a very small country today, maintained its independence — at least from Germany. With the rise of the early modern era the possibility of a new culture coming to dominate Denmark became lesser, and so, even today, Danes are Scandinavians and not Germans.