Stout was first a nickname for strong porter
In the eighteenth century stout simply meant strong. Only later did it become a beer style of its own.

In the early eighteenth century London mostly drank brown ale, a dark, slightly smoky beer. Brewers began to experiment with a new, cheaper kind of malt. That produced a beer that was soon popular with the river workers and parcel carriers of the city, the porters. The beer took their name. Within a few decades porter was England's most popular beer and went to Ireland, the Baltic states and, in large quantities, to the British colonies.
For export, brewers made stronger versions. That heavier version got the nickname stout porter. Stout then simply meant strong or sturdy and was not a separate beer style. The porter of that time had around 3.5 percent alcohol and was still very rich in sugar. Both beers existed side by side, and in Ireland the same beers were brewed.

In Dublin, on 31 December 1759, a 34-year-old brewer signed a 9,000-year lease on a disused brewery, at 45 pounds a year. In the 1770s he began brewing porter. In 1799 he brewed his last ale.
Only later did stout become a style of its own. Barley was heavily taxed as a brewing grain in Ireland, and a clever brewer also chose oats: that gives a dry mouthfeel and made the beer cheaper. The Irish version became drier and more bitter, because less residual sugar was left. The rule of thumb now: porter has traditionally been brewed with malted, roasted malt, while stout often also leans on unmalted roasted barley. Porter feels rounder and sweeter, stout drier and more roasted. It is a guideline and not a law, because brewers call a beer porter that tastes closer to stout, and the other way round. Porter usually sits between 4 and 7 percent alcohol; an imperial stout, once brewed for the Russian court, heads towards 10 percent.
Stout and porter
Porter: early eighteenth century in London, named after the river workers
Stout porter: nickname for the stronger version, for export
A 9,000-year lease on a brewery in Dublin: 31 December 1759, 45 pounds a year
Alcohol in porter: usually 4 to 7 percent