The term 'yellow-belly' is an archetypal American term, but began life in England in the late 18th century as a mildly derogatory nick-name. Grose's A provincial glossary; with a collection of local proverbs etc, 1787, lists it:
"Yellow bellies. This is an appellation given to persons born in the Fens, who, it is jocularly said, have yellow bellies, like their eels."
The usage wasn't limited to the Lincolnshire Fens. In the same year, Knight's Quarterly Magazine (London) published an account of life in the the Staffordshire Collieries. It began by describing the region as "a miserable tract of country commencing a few miles beyond Birmingham" and went on to recount a lady's attempts at guessing the nick-name of a local resident - Lie-a-bed, Cock-eye, Pig-tail and finally Yellow-belly.
Another English directory, A General Dictionary of Provincialisms, by William Holloway, 1839, which contains the obliging sub-heading - written with a view to rescue from oblivion the fast fading relics of by-gone days, also lists the term:
"Yellow-belly, A person born in the Fens of Lincolnshire (From the yellow, sickly complexion of persons residing in marshy situations.)"
Holloway clearly lifted the definition from Grose. How much credence we should give to either Grose's or Holloway's explanation of the origin of the term is debatable. Neither seems especially convincing. It is just as likely that 'yellow-belly' didn't refer to a person's complexion and had no literal meaning, but was simply a piece of nonsense name-calling - somewhat akin to 'lily-livered'.
There is also a story about the Wexford hurling team that was raised by Sir Caesar Colclough to play a match against a team from Cornwall, in the late 16th century. This has a literal element, in that the Wexford players played with yellow cloth tied around their waist to distinguish them from Cornwall, and this caused them to be nicknamed The Yellowbellies. Wexford do still play in yellow and the name has stuck, although it isn't clear when the nickname was first used. This story, in as much as it can be verified at all at this late date, has no connotations of cowardice. The team might just as likely been called the bluebellies or greenbellies if different material had been available on the day. In fact, none of the early English/Irish uses of the name suggest cowardice. For that sense we have to travel to the USA.
The screenplay of a B-feature western wasn't complete without a selection from the list of stock cowboy lingo. You were as likely to find a coward that wasn't called a yellow-belly as you were to see the Lone Ranger without his mask.
The first use of the term that I can find from the USA, and one that suggests the derogatory, cowardly meaning, comes from an account of a military skirmish in Texas, reported in The Wisconsin Enquirer, April 1842:
We learn from Capt. Wright, of the N. York, that it is the intention of the Texans to "keep dark" until the Mexicans cross the Colorado, and then give them a San Jacinto fight, with an army from 5000 to 7000 men. God send that they may bayonet every "yellow belly" in the Mexican army.
The US usage initially applied specifically to Mexicans, who were soon to be at war with the USA. Whether the 'yellow' reference was a racist allusion to skin colour, ill-health, or to a likening to snakes, lizards etc. isn't clear. Whatever the origin, the US 'coward' version seems to be independent of the earlier English nick-name.
See also: the meaning and origin of 'The Yellow Peril'.