From The Word Detective:
A "greenhorn" is simply a newcomer or inexperienced person, especially a novice in a trade or business. "Greenhorn" first appeared back in the 15th century meaning a young ox with new, or "green," horns. ("Green" has been used as a metaphor for "young" or "inexperienced," by analogy to a young plant, for hundreds of years.) By about 1650, "greenhorn" was being applied to newly-enlisted army recruits, and shortly thereafter "greenhorn" came to mean any inexperienced person. Unfortunately, since the naive among us can easily be hornswoggled, "greenhorn" can also sometimes mean "sucker" or "simpleton."

Still, I'd rather be thought a "greenhorn" than a "tinhorn," which since the late 19th century has been slang for a pretentious and flashy but cheap and contemptible person. The original "tinhorns" were "tinhorn gamblers" in the Old West, addicted to a low-stakes game called "Chuck-a-luck," in which dice were tumbled in a small metal contraption known as a "tin horn." Serious gamblers looked down on such "tinhorn gamblers," and by the end of the 19th century "tinhorn" had come into general usage as an adjective meaning "cheap" and "contemptible." A similar adjective, "tin-pot" (often heard in phrases such as "tin-pot dictator"), arose in the early 19th century by analogy to the perceived shoddiness of tin cookware.


I first looked in Brewer's Phrase and Fable. They didn't have greenhorn, but they did have the following entry, whose def. made no sense to me at all:
Green Linnets The 39th Foot, so called from the colour of their facings. Now the Dorsetshire, and the facings are white.