A former NYPD cop once assigned to guard City Hall and the mayor’s residence at Gracie Mansion was arrested for allegedly beating a police officer with a pole at the Jan. 6 Capitol riot, prosecutors and police sources said Tuesday.