There are two types of fennel. Florence fennel is an annual, which is grown for its bulbous white stalks. Sweet fennel is a perennial in mild climates (to zone 6) and is grown for its feathery foliage and for its seeds, which are actually fruits.
Florence fennel was one of Thomas Jefferson's favorite vegetables and in Europe it's commonly eaten as a cooked vegetable. The foliage and bulb has a mild, anise-like flavor. Sweet fennel does not have a big bulb, but its feathery foliage is used as an herb and imparts a similar flavor. It gets to be a huge plant, usually reaching 4 to 6 feet tall, and occasionally 8 feet. The foliage is often used to flavor fish, and the hollow stems can be used as straws for sipping summer drinks.
Both kinds of fennel grow best in full sun and rich soil that gets plenty of moisture and has a near-neutral pH. That said, fennel is quite forgiving of less than perfect conditions. When planting, mix in compost and a little all-purpose organic fertilizer. The plants have only a moderate need for nitrogen, and low needs for phosphorus and potassium.
To get nice, fat bulbs, plant Florence fennel by seed directly in the garden in midsummer approximately 60 days before frost). When planting in early spring, it tends to produce nice foliage, but then goes to seed rather than fattening up the bulbs. Sweet fennel can be planted in the spring after danger of frost and once the soil reaches 50 degrees F., though 60 degrees F. is even better.
Fennel is in the carrot family. It attracts lots of insects, more good than bad, and none of them are particular problems. Of the butterflies it attracts swallowtails, which lay eggs on the plants. You will see their bright green caterpillars (larvae) on the plants; instead of killing them you might move them to wild Queen Anne's lace, another carrot-family plant that is attractive to them. If leafhoppers or carrot rust fly are a problem you can cover the seedlings with garden fabric (row covers).
Florence fennel only survives light frost, while its cousin sweet fennel is hardier. Harvest leaves from both as soon as the plants have enough to spare. Should your plants go to flower, you'll find the blossoms are handsome as well as tasty.