Just like we and other animal rely on food to live, these plants eat insects as their food. Actually all living beings rely on food (plants rely on minerals and water from underground). InsectivorousPlants also sometimes suck the moisture out of the insects.
their own food
cannot change their habitat
to fill their nutrients. some insectivorous like pitcher plant do photosynthesis and eat insects to


Plants need nitrogen so if in places where the soil is lack of a bacteria (which transports  nitrogen from air to soil so plants can absorb it)the plants there transform to insectivorous plants which then with help of its digestive liquids absorbs the nitrogen from the insects by trapping them.