Although the term Kraken is first in print in Systema Naturae (Carolus Linnaeus - 1735), stories about this mythological creature seem to date back centuries earlier. What I am trying to find is the origin of the Kraken myth.
Large sea monsters appear in myths as old as the Bible, and the Kraken is probably a derivation of those legends, embodying the very common fear of the unknown.
Keep in mind that the Kraken is not a mythological creature, but rather folklore. Any connection between the krake (an actual biological species discussed by Age of Enlightenment natural historians) and earlier Norse monsters (like the hafgufa mentioned in much older sagas -- also not mythological like for instance Loki's sea serpent spawn Midgardsormen) is only speculation.
However, the word Kraken is undisputably of Norse origin: a kraki (not capitalised, as it's not a personal name; the final -n is a definite article) originally meant a thin and weak animal. (Torp, Alf & Falk, Hjamlar: Etymologisk Ordbog over det norske og det danske sprog. Ringstrøm. Oslo, 1992. p. 408.)
This animal is explained at length by Erik Pontoppidan, bishop of Bergen in Norway, in his book A First Attempt at a Natural History of Norway from 1752. He extensively cites folklore about encounters and sightings, including an attempt at identifying the animal to the best of his knowledge. He writes (my translation):
The largest of all (living animals) is the krake or the kraxe or the krabbe. It is a round, flat and many-armed animal. It is also called the Horv, the Sea-Horv or the "Anchor-troll".
Many authors old and new which I have consulted know nothing of its exact nature. (...) The ocean hides many things, and among the many and large things the ocean hides from our view and only briefly lets us observe in passing, and the largest and most remarkable of them all must surely be the krake. (...)
Our fishermen all tell the same story without variation, of warm summer days when they row a few miles off land and arrive at the fishing grounds, known to be 500-600 feet deep. Sometimes as they release their lines, they sound the depth to no more than some 120-150 feet, and the sea is so full of fish they can dip their hooks and retrieve them full of fish: they know that the krake is below. While the fishery is bountiful many boats gather to partake. But in this situation they must take great care to sound the depth regularly, for at some point the krake will rise. When the soundings become shorter and shorter they cannot linger, but row with all their strength to land. Then they watch, and after a few minutes the giant monster rises from the sea and shows a small part of its enormous body – no man has ever seen all of it. Some say it has the diameter of a farthingroad (1.86 miles), others say more but I have chosen the smallest number.
At first it looks no different than a group of skerries covered in vegetation. In some places there are irregular humps, in between them fish is stranded, and as it protrudes above the surface large horns can be seen, as tall as a ship's mast and so sharp that if a ship was caught on them it would follow the krake to the bottom of the sea. As it descends again, there is a real danger of being sucked down in the maelstrom.
This gruesome animal can surely be classified as a genus polyporum, or the cross-fish (he probably means molluscs), what we see are probably its tentacles or feelers, with which it moves and eats. And the great Creator has also given it a strong odour, with which is attracts fish to eat. According to many fishermen's experience, the krake eats for some months, then for months again expulses its excrements, so the water above it becomes thick and muddy. The fish flock from all parts to eat this mud as it is delightful to them, but the krake lurks below to swallow them and again turn them into allurment for others.
Since nobody will examine this horrible beast alive, I deeply regret that nobody took the opportinity to study a dead one when the possibility arose. According to Mr. Vicar Friis of Bodø in Nordland, a krake (most probably a young and careless specimen) washed ashore in Ulvangfjord i Alstadhaug in the year 1680. According to him, its tentacles, which it uses in the same way as a snail, that is by contracting and extruding them to move, were stuck in some trees or cracked cliffs by the sea so that it was caught and died. It took a long time to rot as its carcass filled a large part of the fjord and made it unapproachable because of the smell.
I have never heard that anyone has been attacked by the krake and survived it, except one story from Frederikstad in Akershus county: a couple of fishermen went into slimy and muddy waters, and they realised it was the kraken so they quickly left, but one of its tentacles struck the boat so that it broke and they could barely make it to land.
(Pontoppidan, Erik: Det første Forsøg paa Norges naturlige Historie. Copenhagen, 1753. p. 340-354: Digitized by the National Library of Norway here).
He goes on at length, but I believe this quote is sufficient to illustrate his point that the animal is a giant squid. Giant squids are know to have stranded in Norway from time to time and as late as 1975; in total 20 specimens have been documented through modern times. (Norwegian University of Science and Technology: Giant Squid in Trondheim Fjord. This may also explain the seemingly strange name for such a giant, "thin and weak animal": squids' bodies collapse out of water.
Earlier Norse mentions of incredibly large sea monsters have been associated with the krake, among others by Pontoppidan's contemporary bishop Gunnerus in Trondheim. He pointed to the havstramb or hafgufa (sea mist) or lyngbakr (grassy back) mentioned in several Norse texts, among them The King's Mirror from around 1250:
It is said of the Greenland Sea, that there are sea trolls, but I don't think they can be seen very often. People say that the one called havstramb lives there, it is large and stands straight up from the sea. It looks like it has the shouldens and neck and head of a man, eyes and a mouth and a chin, but above the eyes it looks like a man wearing a pointy helmet. It has shoulders but no hands, and it narrows so that nobody knows what lies beneath the surface. It is like a glacier to behold, and nobody can tell whether it has shells like a fish or skin like a man. Whenever it shows itself, a storm is brewing. After it rises from the sea, it splashes down again. If it turns towards the ship when it retreats, somebody on that ship will die. (Brøgger, A. W. (transl.) Kongespeilet. Oslo, 2000. p. 52-53.)
Whether the observed animal is the same as the krake is uncertain. Theories include said giant squid, whales, smoke and gas formations from underwater volcanoes, or simply hallucinations. Bascially the same as any ancient monster story.
I'm less sure about how the word (and animal) transitioned from Norse folklore to a semi-mythological creature and later a horror movie favourite. I'd love to know!