A stout was originally called a stout to differentiate it from a porter. The original names was Stout Porter, and it meant a more stronger porter.
But as has already been said, there is sometimes not much difference between the two of them. A strong porter could easily be called a stout, and likewise a somewhat less roasty stout could easily be called a porter. They are defined this way for the purposes of judging.
Case in point, I made a chocolate stout for my wife who isn't fond of strong roast flavor, so when it was made I felt I had to change it's description to Chocolate Porter, since it really didn't have the strong roast flavor profile that I am used to in a stout.
It's these small things that makes for good conversation between brewers.