A deputy is a sheriff's assistant, the person who fills in when the sheriff isn't available. When a deputy is in charge, she has the same powers and authority as the sheriff.
You can use the noun deputy for anyone who is singled out to step in for another person. A deputy leader of a government fills in when the president or prime minister is ill, and a magazine's deputy editor is qualified to edit an issue when the editor isn't available. The Middle French root is députer, "appoint or assign," from the Late Latin deputare.