Pumpkins are considered fruit because they grow from the ovary of flowering plants that must be pollinated. Basically, if it starts from a flower it’s a fruit.
In case you were wondering (were you?), cucumbers, squashes, watermelons, melons, and gourds are also fruits (and for the same reason)!!