Well, that's not very nice. Fortunately, you can choose how to respond.
It never feels good to learn you are the object of a lie — someone made a deliberate effort to say something untrue about you. You're right to wonder: Why would someone do that?
I'm very sorry that you find yourself if this position. I'm fortunate that I can't remember a time when this happened to me. So, while I can't offer a personal account, I can extend empathy and understand that this is painful to you.
The first step is to decide how you want to respond. I recommend trying to learn from the experience, and use it to increase your emotional intelligence, EI. So, take a good, long look into yourself. Try to uncover exactly how do you feel. Are you embarrassed, angry, frustrated, motivated to do something differently? Once you are self-aware, try to imagine what motivated someone else to disparage you, and decide how best to resolve this breach. Lean on your high EI, especially when dealing with a predicament like this.
Do you have a history with this person? If so, is the relationship friendly, or is it toxic? If it's the latter, consider breaking ties with this person. Or, is this situation a one-off, totally out of character interlude for this person to spread lies about you? If yes, find out why it happened. There could be a simple misunderstanding that needs to be cleared up.
It sounds as though you are very hurt by this, and frankly, who wouldn't be? Examine the situation, and try to understand the motivation. Then, decide if you want to react, and if so, how.
My best advice is always to be polite, and stay steadfast to your high standards. It will not be helpful or productive to spread lies or even talk poorly about this person as an act of retaliation. If you believe the lies were spread in malice, consider distancing or divorcing yourself from this person, even if they are a close friend or family member. On the other hand, if the lie results from a misunderstanding, consider having an open, honest, and respectful conversation to clear things up and move forward.
Ultimately, be your own best advocate. Lead your life with your social codes. Keep your standards high and consistent, and surround yourself with positive, supportive people. Life is too short to compromise.