Of course, in films the evil guys almost always lose.
A lot of this is simply enculturation, we associate things with things through contact.
As for why "bad guy music" sounds cool, it probably has a lot to do with the ways in which villains are intentionally designed and intentionally depicted as "cool".
Darth Vader is cool. We don't want him to win because we know he's the baddie and the Empire is bad, that is obvious from a narrative perspective. But it's still supposed to look cool. The good guys are also meant to be cool, and often more cool.
Sure, Thanos is a cool character. But Iron Man, Captain America, and the rest of the Avengers are just so much more fun to be around, they're more cool, and not to mention they're the good guys.
Bad guy music is dark, it's foreboding, it's ominous, and that's cool.
Good guy music is epic, heroic, uplifting, and that's cool.
But what we identify as "bad guy music" and "good guy music", and general aesthetics of "good guys" and "bad guys" are designed that way based on cultural expectations, motifs, and archetypes.
It's the reason why we code colors the way we do, if you see someone wearing black and red, what do you expect? If you see them, instead, wearing gold and blue, what do you expect?
That color-coding has deep roots, sure. In the West we have long established color coding in our artwork. Take, as a random example, Bosch's Haywain Triptych:
Now, it's not really an accident that this color coding and theming has been this way.
We associate the good with heaven, and the heavenly colors--the sky, the sun, clouds etc--well blue, gold, and white. We associate the evil with hell, and what are the concepts associated with hell? Darkness and fire, black, red, etc.
Colors, sounds, all sorts of things are enculturated by us, and we then apply them to our creative works. Minor keys are "negative", major keys are "positive".
Many things are cross-cultural; other things not so much. Some experiences are common across cultures, other things more unique. All those things interact with each other, and inform the way we interpret the symbolic landscape around us.
-CryptoLutheran