At first glance my thought was "how did that bug get in to my jar? It must've crawled through one of the holes and can't get out."
Then, I noticed a hole in the cocoon. And I realized that bug (which resembled something like a wasp) is what came out of the cocoon. It was not a beautiful swallowtail at all. What was it?
So, back to the "google" drawing board it is. At first I typed in wasp type bugs, but that didn't really give me anything. So, I typed wasp type bugs that emerge from cocoons. And I found this site.
Turns out the bug in my jar IS a wasp. Evidently, "this" type of wasp uses "that" type of caterpillar as a host to lay it's eggs. The wasp stings the caterpillar inserting a parasitic egg, which doesn't immediately kill the caterpillar. Then, after the caterpillar forms it's cocoon to await spring, the egg develops, eventually consuming the caterpillar, and coming out a wasp instead of a butterfly.
In one way, we were disappointed, but, on the other hand, it gave me another opportunity to teach my kiddos. We got to learn, not only about swallowtail caterpillars and butterfly's, but also about wasps. And I got to explain to them that ultimately this was God's will. That He created things this way. And sometimes certain animals and bugs eat others. In this way, populations stay under control and such. God is good! Even if we didn't get to see a beautiful butterfly come out of this cocoon. Besides, we can always try again. And maybe next time we'll actually get to release a butterfly instead of a wasp:)