Loud bang flats that sound almost like a gunshot are the result of a portion of the tube escaping from the tire and blowing up like a balloon before popping with an explosive sound. Once the tube has popped it's not uncommon for the tire to drop back into place thereby concealing the mechanism of what happened.
One common cause is that a bit of the tube was pinched between the rim wall and the bead of the tire on installation. Frequently it can stay like that for a long time without any apparent problem while riding but gradually it pushes the tire bead up and over the edge of the rim and then you get the explosive flat. Or the tire bead may not have been properly seated on the 'hook' at the edge of the rim. Another less common cause is when the tire has a cut in the sidewall and part of the tube can squeeze out of the cut - but that should be obvious upon examination of the tire.