I think the "cowboy" stereotypes about the United States can actually be traced to Buffalo Bill's Wild West Show; see <a href="
https://en.wikipedia.org/wiki/Wild_West_shows" rel="noopener noreferrer" target="_blank">Wild West shows - Wikipedia</a>. It became big in the late 1800s. Wild West shows were a circus-like entertainment. Wikipedia says "The shows consisted of reenactments of history combined with displays of showmanship, sharpshooting, hunts, racing, or rodeo style events." The "reenactments of history" were of course highly fictionalized and romanticized. They often included an attack by Indians on a settler's farm, who were then defeated by cowboys and US Cavalry soldiers, hence the stereotype of "cowboys and Indians."
Although the Wild West shows themselves died out by about 1914, they lived on in the movies. "Cowboy movies" were similar in many ways to the staged stories of the Wild West shows, and these movies were popular internationally and created the global stereotype of "the cowboy," who seemed to spend more time fighting Indians then taking care of cattle.
Cowboy culture was shared with Mexico, and is the source of a large number of Spanish-derived words in US English associated with "cowboys" and "the West:" both <em>lariat (la reata) </em>and<em> lasso</em>,<em> buckeroo (vaquero, </em>i.e. person who works with cattles), <em>canyon </em>(respelling of <em>cañon), arroyo,</em> <em>mustang, burro, caldera, coyote, corral, jerky, poncho, pinto (dappled horse), stockade, stampede, vigilante, </em>and of course the names of the states <em>Arizona, California, Colorado, </em>and <em>Nevada.</em>