You've found a sphinx moth pupa. The caterpillars are the hornworms, which includes the notorious tobacco and tomato hornworms, as well as many non pest species.
After the caterpillars finish their development, they burrow into the soil to pupate.
The adult moths of some species do not feed and lack mouthparts. Others, like the one you found, have a long proboscis to drink nectar from flowers. These moth drink while hovering in flight in front of a flower, like a hummingbird, giving rise to another common name, hummingbird moth. The unusual loop at the head of your pupa contains the developing proboscis (mouthparts) of the adult moth.