A soldier or police officer who specializes in shooting a gun very accurately from far away is a sniper. The U.S. Army has a special sniper school for training soldiers.
Sometimes criminal shooters are described as snipers, especially if they shoot at people from a hidden spot. However, this word most often means "trained marksman," especially someone who's trained in the armed forces or by law enforcement, like a member of a SWAT team. Sniper comes from the less-common verb snipe, "shoot birds from a hidden place," from the noun snipe, "long-billed marsh bird."