What is the purpose of D-Bag in skydiving parachute?
Qualifier: I am a master parachute rigger.

The bag serves two functions - it allows the suspension lines to straighten out in a controlled manner, and it prevents the canopy from inflating before the lines are fully stretched out.

It is not always required - people who want a very fast opening can pack without a bag, I have done this many times myself. However, you do NOT want to do this after a drop of more than about 5 seconds. These jumpers open the main canopy immediately after exiting the aircraft.

On main canopies the bag and pilot chute are connected to a ring on the top of the canopy. The assembly just follows behind. Some canopies have a mechanism to collapse the pilot chute and/or retract it onto the top of the canopy.

The bag for the reserve canopy is not connected. This allows the reserve to still deploy if the pilot chute gets caught on something else, the bridle is extra long (longer than the suspension lines). It falls separately and usually lands within a kilometer of the airport, near the main canopy if that one was released when it malfunctioned. As they cost about $200 a set the jumpers will put considerable effort into finding it. We usually don't find it in high crops, and we usually don't try to find it at some places in Florida where there is an alligator ranch beside the airport.