I just read about this in "The Westerners" by Dee Brown. I will bring the book tomorrow so I can quote from it. But, I will write now what I can remember.
During the Revolutionary War, loyalist "cowboys" would hide in the brush and ring a cowbell to lure a Yankee in to kill him. The Yankee would be going into the brush to get the cow for food. So, the term "cowboy" was not a good term.
When Charles Goodnight setup in the cattle business he called his workers "boys". Over time it morphed into "cowboys". As Goodnight aged, he forbid his "cowboys" from cussin', card playing, drinkin' spirits, etc. on the job. So, at the end of a drive, the "cowboys" would go "paint the town red", which didn't help the reputation of the "cowboy".
Slim