You deserve something because you did something to earn that something
e.g. I deserve to go to the restaurant with my wife on a Friday night because I spent all week working i.e. I earned the money and I earned the right to spend this money on what I want.
So if you "deserve" something, you "have earned the right" to it.
I don't know your context but I guess it's a response to someone who wants something, which reassures him or her that he or she should have it.