Roylott is a doctor because, as Holmes points out, doctors make excellent murderers.
In terms of the story, it is significant that Roylott is a doctor because it makes the fact that he is a murderer the more despicable. Holmes makes a comment about when doctors go bad.
When a doctor does go wrong he is the first of criminals. He has nerve and he has knowledge.
A doctor knows more about how to hurt people than the average person, in other words. Also, it is worse in some other ways. Doctors are supposed to help people, not hurt them. There is the Hippocratic Oath to consider, which means that a doctor is not supposed to harm even when he cannot help. Still, Holmes has a point. Doctors make excellent murderers.
As it happens, Dr. Roylott is an odd sort of doctor. In fact, he is no longer a practicing doctor at all. He is really more of a moocher.
Dr. Roylott then abandoned his attempts to establish himself in practice in London and took us to live with him in the old ancestral house at Stoke Moran. The money which my mother had left was enough for all our wants …
Of course, this is part of the problem. Roylott seems to prefer living off of his dead wife’s money and playing with his exotic animals rather than doing any real work. Thus he decides to prevent his twin stepdaughters from getting married and reducing his income.
He has the skill and nerve, as Holmes points out, because he is a doctor and he has a menagerie of bizarre animals, including a swamp adder, “the deadliest snake in India.” I am sure many people keep those as pets! Roylott has trained his to come to a whistle and kill for him. Wow! When good doctors go bad, they go really bad.
A good mystery often has a murderer you do not expect. We naturally think that a doctor is going to be a good person, because we expect doctors to want to help people. This makes Roylott the perfect murderer. He is the last person we would suspect.