There is a Washington Irving story @ 1830 where he writes
of passing “cowboys” driving cattle to market in New York state.
It might even be a word used in England originally.
I did a little more research and yes, it was used on rare occasion instead of drover or cowman or cowpuncher or cattleman. Still, it became more wide-spread from the outlaw gang/ranchers of the Clantons/McLaurys whose theft of Mexican cattle became known as the "Cowboys". BTW, the Clantons and McLaurys and associates were the first known group that could be called organized crime out West. New York had its Five Corner gangs.
The term morphed from those notorious cattle rustlers into a more benign acceptance of all those who wrangled cattle. Interestingly, the term now includes anyone who wears a cowboy hat.
I just visited a site about Stetson hats. They were not called cowboy hats. They had numbers and included everything from bowlers to 10 gallon to wide brim with flat top that Wyatt Earp wore and more. Plus there were numerous fur felt hat producers back in the day. That's why you see such a variation in modern westerns, not to mention the wear and tear on said hats. The old west fascinates me.
http://www.indianvillagemall.com/stetsonhats.html