When you apologize, mean it. There’s no use saying, “I am sorry,” and not meaning it.
Otherwise, it’s malevolence.
If the person you are apologizing to refuses your apology, accept that their behavior is a consequence of yours. Believe that if you meant anything to them, they’ll come around eventually, by reaching out to you to let you know that they have forgiven you.