First of all, don't take it personally. It's not your fault, it's the fault of the restaurant you picked. Maybe you ate there before and the food was better, or perhaps your friend has higher standards or is a picky eater. Recognize that you are not responsible for choosing their experience, but that doesn't mean your experience has to be the same.
Additionally, some people come from families or cultures where it's common to establish common ground with other people by complaining. In some groups, this is akin to an art form, where each of the group attempts to out-do the others with tales of awfulness.
Because it's familiar and comfortable behavior, your friend might do it without thinking about it, and even without even thinking the food is all that bad. It's just a habit.
Personally, I would take a step back and look on it objectively as a kind of unintentional joke. You treat someone to a free meal, and all they can do is complain? Who does that? Probably someone who is going to complain no matter what you do, so why worry about it? Enjoy the theater.
Which gives you several options:
Play along with the joke
Complain right along with your friend. Attempt to out-do them by pointing out every flaw in every dish. Exaggerate to the point of ridiculousness, if you think you can get away with the absurdity without having your friend feel like you are making fun of them.
Ignore the complaints
Utter polite but non-committal responses. "Oh, that's too bad," "What a shame," "I'm sorry you feel that way," and so on. Don't engage -- just eat your food, attempt to direct the conversation somewhere else, and leave the restaurant as quickly as is reasonable. Expect your friend to continue complaining on the way home -- but hey, if they get that much joy from it, let them get it out of their system.
Demonstrate having a positive experience anyway
It's a buffet, right? So ask them, if a particular dish is so bad, why are they eating it? Point out dishes that might be better, particularly those that you liked. There must be something among the many choices that they would like, right? Look for the best the restaurant has to offer, even if it's only the desserts.
Attempt to show them the absurdity of their behavior
(Note: I would do this only with close friends and family who seem open to change. Otherwise it can turn into an unwanted "What gives you the right to tell me what to do!" argument.)
This is from personal experience, at a time in my life when I thought belittling others was a good way to elevate myself among friends. I tried this kind of complaining once with an (older and wiser) friend, who simply responded
Look. It's a beautiful day. I'm happy. You're happy. The people around us are happy. We're eating good food at a nice restaurant, enjoying ourselves. Do we really need that kind of negativity right now? Where did you learn that behavior? Who taught you that was OK? Can't you see you're just intentionally tarnishing your own experience?
And so on. This attitude got me to see the world in an entirely different way, and while it created some friction with my old friends and family, over time I got them to change as well -- well, at least when they're around me.