There are, perhaps, a couple of reasons why storytellers use Confederate soldiers as a protagonist, chief among them a kind of romanticism of the defeated quality. However, there is a real and historical reason that is in place.
The so called “wild west” (as a fictional construct and a place of massive expansion in a short period of time in American history) has its roots in the Civil War. Displaced Confederate soldiers went west and some of them who engaged in, and were masters of certain military fighting styles (primarily guerrilla warfare) rose to great prominence, especially in the Eastern Establishment media, and their exploits have been fictionalized and memorialized ever since.
Jesse James had very strong Southern sympathies. He rode with “Bloody” Bill Anderson and participated in the Centralia Massacre. Frank James was one of Quantril’s Raiders and also participated in a massacre. Then they went west, formed the James-Younger gang, and entered into the public consciousness as folk heroes. People still talk about the Northfield bank robbery, and its aftermath, to this day. His story still holds sway over audiences, The Assassination of Jesse James by the Coward Robert Ford was turned into a critically acclaimed movie in the 2000s.
He isn’t the only one, there are many others.
There is a great book on the subject, The Ghosts of Guerrilla Memory by Matthew Christopher Hulbert. It’s out from an academic press so it is pricey, but should be able to be obtained through your library for any who might be interested.
As one reviewer of the book succinctly put it:
“Why do Americans seem more comfortable with ex-bushwhackers as gunslingers and cowboys and bank robbers than as participants in the war that saved the Union and emancipated millions of African slaves?”