An explosion in an apartment building was caused by damage to a gas pipe that was most likely inflicted by workers trying to illegally tap into a water pipe.