If you want to attract something like this, a swallowtail butterfly,
your going to have to put up with caterpillars, which are swallowtails in the larva stage.
Caterpillars can do enormous damage to a vegetable garden. They are voracious eaters. In this photo the host plant is a 3 foot fennel bush. This particular specie also likes dill and parsley and other members of the carrot family. The caterpillars will eventually strip all the fronds from the stems.
If you are not interested in saving the caterpillars then ridding them from your garden can be done in two effective ways:
1. Pick them off by hand and put into a pail of soapy water;
2. Spray the plant and underside of leaves with Bacillus thuringiensis, commonly known as BT.
Photographer Bob Moul has a great slideshow showing the morphing of a caterpillar into a butterfly.