One counseling psychologist wrote a whole book and has developed a career to answer the OP’s question:
"No More Mr. Nice Guy" by Dr. Robert Glover, who states that he himself is a “recovering nice guy.”
He considers being a Nice Guy, as typically understood, as a malady of sorts, peculiar to our modern culture. He prescribes ways to get over this, but not by becoming a jerk either.
His basic answer to why girls seem to go for jerks is for Nice Guys to start figuring out all the good things these “Jerks” possess, and which attracts females, (i.e. confidence, manliness, life energy) and not focus on the sometimes less desirable “jerkish” traits. Nice Guys have a lot of positive traits that girls like in their friends, but these traits don’t generally attract them to them as mates.
Here’s Dr. Glover’s website:
nomoremrniceguy.com/
His book has some really great stuff, but he also gives some advice that goes against Catholic teaching (such as engaging in “healthy masturbation”), so be warned.