Sometimes, you're writing a character who's – frankly – a bit of a git.
Trouble is, you want your readers to have at least some sympathy for them.
Your character might be an anti-hero. They might be a character who's selfish or unpleasant at the start of your novel, but who goes through a significant change as the story progresses. They could be someone who switches sides (or who isn't on anyone's side but their own).
Whatever the exact situation, you want the reader to feel some level of sympathy toward the character – without having to rewrite that character as someone a lot nicer and kinder.
So how do you go about that? Here's a shopping list of things you could try:
#1: Crappy Childhood
Okay, maybe this one is overused ... but if you can show the reader why this character is so mean to everyone, or why they keep betraying their friends, we're more likely to feel sympathetic toward them.
#2: Redeeming Features
It doesn't necessarily take a lot to make us feel more warmly toward a character. Maybe they're an outright jerk most of the time – but they're surprisingly kind to children. Maybe they wouldn't think twice about murdering people ... but they're fiercely loyal to their friends.
#3: Bad Things for a Good Reason
Some not-so-nice characters can sit comfortably in the "protagonist's" role because they do bad things for a good reason. Think of Dexter Morgan in Dexter, for instance, who hunts down and kills serial killers. (Not coincidentally, he also has a traumatic childhood backstory, and is invariably kind to children.)
#4: Disproportionate Suffering
If your not-so-nice character winds someone up and gets punched or slapped, we'll probably think "Good! They deserved it."
If your not-so-nice character winds someone up and gets badly injured / hospitalised as a result, we'll probably feel a fair twinge of sympathy.
#5: Attractive Qualities
Maybe your character has something going for them – they're good looking, for instance, or they're charming, intelligent, cultured ... whatever it is, they're hard to outright hate.
Gaining your readers' sympathy for your characters can be a tricky business. Sometimes, you might find that readers are irritated by the characters you – as the creator – love (Wesley Crusher, anyone?) or that they don't have an ounce of sympathy for someone who you felt was pretty deserving of it.
Other times, you might create a character who's supposed to be an massive git with pretty much no redeeming features, but your readers think they're "misunderstood" (this is what TV Tropes calls the "Draco in Leather Pants" syndrome).
But there are things you can do to at least improve the chances of getting your readers to feel sympathetic towards a character – and the five methods above are great ones to try out.