The figure is Stack O'Lee (also Stagger Lee, Stackolee), a legendary African American folk character from the late 19th century.
In 1895 St. Louis, "Stack" Lee Shelton shot Billy Lyons during an argument over a hat (or gambling). The event spawned hundreds of song variants.
"The Ballad of Stack O'Lee" portrays him as a fearless, violent "bad man" yet loyal to his code. Famous recordings:
Jim Croce's 1973 hit "Bad, Bad Leroy Brown" is a separate, fictional character. Stack O'Lee is the earlier, grittier folk archetype.