The genetic history of the pumpkin is so intertwined with the squash and the gourd that it's sometimes difficult to tell them apart. Generally speaking, a pumpkin is something you carve, a squash is something you cook, and a gourd is something you look at. Although it's really not that simple, it's also not that difficult.
The answer is in the stem. Pumpkins, squashes, and gourds all belong to the same genetic family Cucurbita. Within that family are several species or subgroups: Cucurbita pepo, Cucurbita maxima and Cucurbita moschata. The pepo species is usually recognized as the true pumpkin. Varieties within this group have bright orange skin and hard, woody, and distinctly furrowed stems. But the group also includes gourds, vegetable marrow, Pattypan summer squash, scallop summer squash, gray and black zucchini, and summer crookneck squash.
The maxima species also contains varieties that produce pumpkin-like fruit, but the skin is usually more yellow than orange and the stems are soft and spongy or corky, without ridges and without an enlargement next to the fruit. They don't really make good handles for jack-o'-lanterns. Varieties such as Atlantic Giant, Big Max, and Show King are often listed as pumpkins but are more properly called pumpkin-squash or squash-type pumpkins. Other members of the maxima group are Hubbard squash, banana squash, buttercup squash, and turban squash; in short, most autumn and winter squash.
Finally, there's the moschata species. Varieties in this group are usually long and oblong instead of round and have tan rather than orange skin. The stems are deeply ridged and enlarged next to the fruit. Ironically, a member of this group is used for much of the canned pumpkin sold in this country. Other nonpumpkin members include the squash-like cushaw, winter crookneck squash, and butternut squash. Insects - Pumpkins have the same insect problems as squash.