Beeswax is a natural wax that honeybees produce. The only bees in the hive that produce it are the young worker bees (females) in the colony. They secrete the wax from their abdomen from the 8 wax scales, in a liquid form which hardens when it hits the air. Once it solidifies, the bees use their legs and mandibles to shape the wax into honeycombs. It takes somewhere around 1,000 wax scales to make up a gram of beeswax for the comb.
In order for bees to create wax, they have to consume large amounts of food. Some reports are that in order for 1 pound of beeswax to be created, bees need to consume 8 pounds of honey.
Bees create beeswax for several reasons:
Cap brood cells
Mix with propolis to seal crack in the hive
Create cells for storage
Most beekeepers use the wax processed from their capped honey. As pictured below, when processing honey, the beekeeper first needs to cut the wax capping off. These are saved and processed. This is the wax that is later turned into salves, soaps and other products.