Showing the villain (or Anti-Hero) engaging in a moment of kindness, especially towards someone who can't repay them, as a way to humanize or soften them. May or may not involve an actual dog.
This is a screenwriting term: put in a scene where the nasty old crank pets a dog and the audience will think, "Aw shucks, he's not so bad." Often used to demonstrate that a Jerkass is really a Jerk with a Heart of Gold, or, if more limited, that the character is goal-oriented rather than sadistic and/or evil for evil's sake. If used as an Establishing Character Moment, it marks the character as "not too evil" right off the bat, whatever they might do later.
Sub Tropes include Even Bad Men Love Their Mamas, Morality Pet (a villain's entire relationship with a particular character is one long dog-petting session), A Friend in Need, and Androcles' Lion (the dog later aids the villain as a reward for their kindness). Compare Licked by the Dog, where the innocent character shows kindness to the villain.
If you want to pet dogs while keeping your villain credentials intact, try doing it anonymously, doing it but denying any benevolent intention, or doing it because you only kick PEOPLE, not dogs. Demonstrating Moral Myopia could also work (if the people you favor aren't evil).
Contrast Kick the Dog (doing something evil to establish an evil personality, with many, many villains having both), Photo Op with the Dog (where it's all an act for the good publicity) Must Make Amends (when a character tries to undo or atone for having Shot The Dog), Bait the Dog (when a moment like this is set up and then darkly subverted). May overlap with Out-of-Character Moment if the villain shows kindness for no apparent reason.
In modern Hollywood circles, this is also referred to as "save the cat", with the idea being that if you show your hero stopping to save a cat stuck in a tree as his Establishing Character Moment, you're putting the audience on his side forever.