Dongle, a device that plugs into a computer to provide additional functionality such Wi-Fi, Bluetooth or storage, first appeared in the 1980s. The New Scientist magazine mentioned the dongle in an article about the Commodore PET Personal Computer in 1981, describing it as “an extra piece of memory that is plugged into the computer.”
The Oxford English Dictionary says it was an arbitary formation (a random choice or personal whim). One theory is that dongle is a playful corruption of the words dangle, meaning 'to hang loosely swaying to and fro' and dong, the slang for penis. The latter is thought to have come from the 1877 poem by Edward Lear called 'The Dong with the luminous nose' about a fabulous creature with a large, somewhat phallic nose strapped to its face.
Sources: Oxford English Dictionary online | The Origin of the word 'Dongle' (The Atlantic)