Gandy dancer is a slang term for workers who provided maintenance of railroads in North America.
The term originates from the mid to late 19th century. Hand crews, who replaced worn or damaged wooden ties that supported the rails, used specialized hand tools manufactured by the Chicago-based Gandy Tool Company . Often the crews used vocal and mechanical cadences to synchronize the swinging of their tools to the movement of their feet. Hence the name "Gandy dancer."
The British equivalent is "Navvy" from "Navigator", originally canal-builders who presumably navigated around the country side.