The term mealworm is commonly used to describe the larvae of two types of insects, the Darkling beetle and the Indianmeal Moth. Though they are separate insects, they enjoy the same habitat.

...
Mealworms can be found in your kitchen's flour supply.

Grains

Grains are the most popular place to find mealworms. The larvae of an Indianmeal moth, called Indianmeal worms, are often found in the flour supplies of kitchens. They will feed on the flour until they turn into a moth. The larvae of the Darkling beetle is more likely to be found in unharvested grains or grains that are stored in silos.

Food Preparation Areas

Both types of mealworms can be found in food preparation areas. The Indianmeal worm will often be there due to transporting in the flour, while the larvae of the Darkling beetle will come along after food is prepared to clean up any leftovers.

Barns

The wood in old barns often attracts Darkling beetles to lay their eggs. When the eggs hatch, the larvae will feed on the wood in the barn.

Dark and Dry Areas

Both Indianmeal worms and Darkling beetle larvae can be found in dark and dry places. Little moisture is needed for mealworms to survive.

Fields

Though rare, Darkling beetle larvae will also survive in large fields with lots of wild grasses and seeds. They will live under large rocks or logs in the area.