Using "cowboy" as a perjorative does a disservice to the historical figures.
Over the last several years, "cowboy" has been used as an adjective, often to describe political and diplomatic efforts of primarily American politicians. Those who use it generally don't intend to be complimentary. At first blush, that seems strange. The cowboy, for decades, was an iconic figure of American popular culture and national mythology. To associate an American leader with such a figure would therefore seem positive. At some point, however, that relationship got twisted.
That point seems to have coincided with the emergence of Ronald Reagan as a serious, national political figure. Reagan, of course, first made a name for himself as an actor, and the Hollywood of his era made lots of westerns. Reagan, apart from his love of riding horses on his California ranch, was strongly associated with Hollywood westerns, both film and television varieties. Because of his political philosophy, Reagan was not a favorite of the Left in either Europe or the United States. Coming from showbiz made Reagan an easy target of ridicule; being associated with Hollywood's version of the nineteenth century American West seems to have been irresistible.
Those who opposed Reagan politically tended to view him as dangerously unsophisticated, too ready to resort to military force. It's equally true that the few westerns produced through the late Sixties and on through the Seventies tended to be dark, extremely violent tales centered on loners. That negative image of cowboys probably informed the criticism of Reagan's foreign policy as simplistic, unilateral, and dependent on the threat of force. George W. Bush, a Texan, has similarly been criticized for his cowboy approach to the world.
The original cowboys deserve better. They were, in fact, largely boys-- teenagers-- and they did the difficult, dangerous job of driving large herds of cattle overland, often from Texas, to railheads in Kansas or Missouri. Cowboys were American whites-- and freed black slaves, and European immigrants, and Mexican vacqueros. And Indians. Many of them wanted to earn enough to buy their own ranches, and many of those succeeded. As a group, cowboys were laborers who did a tough job as well as they could. Such people would seem deserving of better from the modern world.
Of course, those who use "cowboy" as a perjorative likely don't have the real things in mind. Nor are they likely thinking of nuanced Hollywood cowboys portrayed by James Stewart or Henry Fonda. They're probably not thinking of the cowboy characters that dominated television for two decades, either. Matt Dillon, Lucas McCain, Paladin, and others were characters who resorted to violence only reluctantly.
The cowboy image that seems most in line with actions denounced as cowboy would seem to be the image portrayed in the "spaghetti westerns." Those films emphasized gunplay and bloodshed over character. As the name suggests, though spaghetti westerns often featured at least one American actor, they were made in Europe by Europeans. Perhaps, therefore, they can be seen as a European take on an American myth. That view may now influence political discourse. Maybe less cultural shorthand would be more useful.