The John Doe custom was born out of a strange and long since vanished British legal process called an action of ejectment. Under old English common law, the actions landowners could take against squatters or defaulting tenants in court were often too technical and difficult to be of any use. So landlords would instead bring an action of ejectment on behalf of a fictitious tenant against another fictitious person who had allegedly evicted or ousted him. In order to figure out what rights to the property the made-up persons had, the courts first had to establish that the landlord really was the owner of the property, which settled his real reason for action without him having to jump through too many legal hoops.
Frequently, landlords named the fictitious parties in their actions John Doe (the plaintiff) and Richard Roe (the defendant), though no one has been able to find the case where these names were first used or figure out why they were picked. The names don’t appear to have any particular relevance, and it might be that the first names were chosen because they were among the most common at the time. The surnames, meanwhile, both reference deer—a doe being a female deer and roe a Eurasian deer species (Capreolus capreolus) common in Britain. They might also have been the actual names of real people that a particular landlord knew and decided to use. Unfortunately, we just don’t know.
Whatever their ultimate origin, the names eventually became standard placeholders for unidentified, anonymous or hypothetical parties to a court case. Most U.S. jurisdictions continue to use John Doe and his female counterpart, Jane, as placeholder names, and will bring in Roe if two anonymous or unknown parties are involved in the same case. The Feds use these placeholders, too, perhaps most famously in Roe v. Wade. The Jane Roe in that case was actually Norma Leah McCorvey, who revealed herself soon after the Supreme Court decision.