Venus fly traps are examples of carnivorous plants. Other members of this exclusive club include sundews and pitcher plants. They all use different methods to lure insects (and sometimes larger animals) to their deaths, but their reasons are the same.
They are bog plants and are usually found growing on extremely poor soils, which have often been leeched of all their nutrients. This would normally constrain the growth of a plant which, in addition to sunlight and CO2 from the air, requires trace elements from the soil to spice up its photosynthetic cooking pot. Foremost amongst these are phosphorus and nitrogen, which are critical for DNA and protein synthesis. Without these molecules cells cannot divide and the plant could not grow.
As a result of this selective pressure carnivorous plants have adapted to flourish in such nutrient-poor environments by looking to the air for their additional nutritional requirements. Not in the form of gases but other living things that they can digest.
In all cases once the plant secures a "catch" it breaks down its meal using a cocktail of degradative enzymes, similar to our own digestive juices. The chemically chewed-up products of these repasts are then absorbed locally into the leaf (all of these plants form their trap machinery from modified leaves).
So in summary, carnivorous plants have developed a few key mutations that enables them to survive in a hostile environment where competition from other plants, and possibly predation by animals, is much lower.