Chiefly, it’s because you’re hungry and not at home.
Beyond that, there are three main reasons and I’ll tell you the others in a sec’.
Food in restaurants is that which you don’t have the the time to prepare at home. You’re busy, distracted, didn’t shop, have a small pantry.
You also don’t have the skill to prepare the very best of what you eat while dining out. All the books and articles and shows that purport to teach cooking don’t tell you the simple truth: Buy the best ingredients you can afford. Learn to use salt and pepper properly. Make an effort to cook a half dozen dishes until you can do them “perfectly” and fast.
Finally, it’s often a cultural experience to dine out. The first “real” French food arrived in the U.S. due to the advent of affordable trans-Atlantic airfare, and people began to experience regional dishes, bistro food, and French fare that wasn’t informed by massive amounts of butter and cream. Moving forward, Japanese food became popular around 1984; Thai, Mexican, Vietnamese, Indian all arrived. It is a way to experience the foreign for most.
The restaurants that don’t fit into these three “categories”–Prep, Skill, Culture–tend to be about the chef, marketing, and fat. They’re fun, especially when you’re on the road, but hardly memorable.