A viceroy is a royal official who rules an area in the name of the King (or Queen). The word is made of 'vice' (Latin for 'in place of') and 'roy' (French, meaning 'king').
The title was used when an empire has widespread territories which the monarch would rarely visit. It was used regularly by the Spanish, Portugese, Russian, Habsburg and British empires. In the British Empire a viceroy was only appointed in the case of British India, and only then for Lord Canning in 1858. Otherwise it was just a ceremonial name for the Governors-General.