For those like me who were curious, from the Wikipedia article[1]:
According to the OED, "It has been suggested that it originated as a term for a master's most able apprentice, or alternatively that it was transferred from earlier use for a member of a ship's crew, but confirmatory evidence for either of these theories appears to be lacking." The earliest known appearance of the phrase in print is 1931 from the Albuquerque Journal: "Among the electricians ... the department head is the gaffer, his first assistant is the best boy."