The cookbook Küchenmeisterei (Mastery of the Kitchen), published in Nuremberg in 1485, offers a recipe for “Gefüllte Krapfen”, sugar free, stuffed, fried dough cakes.
A recipe for fried dough “nuts” was published, in 1750 England, under the title “How to make Hertfordshire Cakes, Nuts and Pincushions”, in The Country Housewife’s Family Companion by William Ellis.
Dutch settlers brought with them to early New York (or New Amsterdam). These doughnuts closely resembled later ones but did not yet have their current ring-sized shape. One of the earliest mentions of “doughnut” was in Washington Irving’s 1809 book A History of New York, from the Beginning of the World to the End of the Dutch Dynasty:
Sometimes the table was graced with immense apple-pies, or saucers full of preserved peaches and pears; but it was always sure to boast of an enormous dish of balls of sweetened dough, fried in hog’s fat, and called dough-nuts, or oly koeks: a delicious kind of cake, at present scarce known in this city, excepting in genuine Dutch families.
The name oly koeks was almost certainly related to the oliekoek a Dutch delicacy of “sweetened cake fried in fat.”
Hanson Gregory, an American, claimed to have invented the ring-shaped doughnut in 1847 aboard a lime-trading ship when he was 16 years old. Gregory was dissatisfied with the greasiness of doughnuts twisted into various shapes and with the raw centre of regular doughnuts. He claimed to have punched a hole in the centre of dough with the ship’s tin pepper box, and to have later taught the technique to his mother.
Smithsonian Magazine states that his mother, Elizabeth Gregory, “made a wicked deep-fried dough that cleverly used her son’s spice cargo of nutmeg and cinnamon, along with lemon rind,” and “put hazelnuts or walnuts in the center, where the dough might not cook through”, and called the food ‘doughnuts’.
Another theory on their origin came to light in 2013, when a recipe for “dow nuts” was found in a book of recipes and domestic tips written in 1800 by the wife of Baron Thomas Dimsdale, the recipe being given to the dowager Baroness by an acquaintance who transcribed for her the cooking instructions of a local delicacy, the “Hertfordshire nut”
Wikipedia has a great page of info here