The history of the Great Dane is somewhat clouded. There are dogs depicted in Egyptian writings that resemble the Great Dane, giving the indication that they may have been around a long time. There are also mention of Great Dane like dogs being used in med-evil times as war dogs. It is also believe that they were used to ward against evil spirits in ghosts in the late medieval times and thus were used to roam on their owners estates. The truth is the dog in those depictions were probably similar but certainly not the same Great Dane as we know them today.
Most believe the forerunner to the Great Dane we know today was developed in Germany in the 1700s by cross breeding the Irish Wolfhound with a Mastiff (most likely English). There is some dispute however by some that it was developed in England rather than Germany. Wherever it originated, it was bred for the main purpose of hunting wild boar in the open terrain of Europe. The wild boar in Europe, much like the boar that are now plaguing the southern united states, are fearsome creatures. Their tusks are sharp and can slice through flesh with ease. They are powerful, fast and have a mean disposition. The original breeders of the Great Dane needed a dog that could match the boars bad attitude, quickness and strength at the same time being more agile than the "aloof" Mastiff. Through selective breeding the "Great Dane" was born. Though at the time it was referred to as a "boarhound". These early boarhounds most likely closely resembled the Danes we see today, they were far from the family loving couch potatoes that love everyone. The early Danes were mean, fearsome dogs, as such a disposition would be needed in a hunting dog tackling such vicious prey.
So you must be wondering how the name "Great Dane" came about since the Danish had nothing to do with the breed. According to most books, a French naturalist, the Comte de Buffon, happen to see the breed while traveling in Denmark in the early 1700s. Astonished by the dogs stature he deemed the dog "le Grande Danois" or Great Dane, a name that seemed to stick although in Germany they are referred to as "Deutsche Dogge".
The Germans are mostly credited with producing the Great Dane as we know it today. German nobility, most notably Otto Von Bismark, imported the dogs from England and began selective breeding them to be a more slimmer version of their stockier English cousins. In addition to breeding for particular physical characteristics, they began to also breed out the prey drive. Over the next century the Great Dane as we know it today is the product of those early breeders.