In the mid-90s, various companies were looking to set a unified standard for the short-range radio link industry which comprised of several companies home-grown solutions, such as Ericsson's MC-Link and Nokia's Low Power RF.
In December, 1996, they agreed to use the proposed codename of "Bluetooth" which was in reference to the King of Denmark, King Harald Bluetooth.
King Harald I was the Scandinavian king in the 10th century who was referred to as "Bluetooth" because of his extreme fondness for blueberries and the consequent blue staining of his teeth.
Harald, albeit for only a few years, successfully unified the Danish tribes into a Danish kingdom around 970. This is similar to what the wireless protocol Bluetooth achieves, with its unification of wireless devices.
The Bluetooth logo also takes influence from Harald by using the initials of his name in runic initials, which can be seen in the blue oval of the logo.
Originally, the Bluetooth name was only intended to be used as a codename, but it ultimately stuck around and became the official name of the standard.