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 their real reason for action without the landlord 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 being a specific 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.