I believe that it actually merely referred to a man who owned property.
Thus there was no contradiction between calling someone a ‘gentleman’ and a cad. Like “decimated’ the word has been abused and corrupted until it has no meaning.
gentle
early 13c., from O.Fr. gentil “high-born, noble,” from L. gentilis “of the same family or clan,” from gens (gen. gentis) “race, clan,” from root of gignere “beget” (see kin), from PIE base *gen- “produce.” Sense of “gracious, kind” (now obsolete) first recorded late 13c.; that of “mild, tender” is 1550s. Older sense remains in gentleman “well-born man” (late 13c.). Gentleman’s agreement is first attested 1929.
Thus gentleman originally meant a nobleman, with the necessary degree of being “well-born” needed to qualify working its way down the social scale over the centuries.
For a long time only those who didn’t “need to work” were included.
“Decimated” still has some meaning. It’s not something you want to happen to your side. :)