Pumpkins are admittedly closer than most. They are botanically a type of berry called a “pepo” due to their seed-bearing fleshiness and hard outer rinds. This means that pumpkins are fruits to botanists because they are the “fruits” of pumpkin plants, but it doesn’t mean that they are actually “fruits” as we typically use the word. Their culinary classification requires a bit more discussion.
Pumpkins satisfy many of the requirements of being a culinary fruit. They are colorful, kind of sweet, and they are made into pies. These are all things that are typical of fruits. When was the last time you had pumpkin outside of dessert? I don’t remember ever having it in another way.
Yet the pumpkin is not a fruit culinarily. It is a vegetable—no doubt about it. This is the general conclusion of society. Walmart classifies them as vegetables, Stop & Shop classifies them as vegetables, the FDA classifies them as vegetables and even scientifically, they are classified as culinarily vegetables. The consensus is clear.
As for why, this does kind of make sense. Pumpkins are a type squash, and other squashes are eaten more normally as vegetables. Also, you may hear “pumpkin” and think “pie” or “latte”, but many people do eat pumpkins in savory dishes. I assume non-pie uses were more common in the past (when its categorization was set) as well. They’re not exactly savory, but some great demonstrations of its uses can be seen demonstrated by Jon Townsend:
In addition, just looking at it objectively: pumpkins are never eaten raw, they have a bit of a shelf life, they’re not that sweet, and they grow on the ground. These are things more characteristic of vegetables. If you looked a pumpkin without knowing how they are used in the modern day, you would conclude that they are vegetables. Perhaps the vegetable pies are more the oddity than the pumpkin classification.