Sheriffs being elected is actually
extremely important. A sheriff is a constitutional entity who has far more influence than a typical police officer. Having the public choose such an official, rather than having them be hired by a city commission is very preferable - because they can be removed by the people.
This isn't to say everything sheriff's do is good, they're obviously just people and prone to corruption like anyone else. That said, sheriffs who refuse to arrest people for certain things (such as marijuana, or for their sexuality) has been a significant force in protecting people from unjust laws. [0]These days, that same power is being used to try to protect the 2nd amendment.
[0]https://www.youtube.com/watch?v=ENLUaosbNXc