Massive gas injection (MGI) experiments have been carried out in many tokamaks to study disruption dynamics and mitigation schemes. Two events often observed in those experiments are the excitation of the m = 2, n = 1 magnetohydrodynamic mode, and the formation of cold bubble structure in the temperature distribution before the thermal quench (TQ). Here m is the poloidal mode number, n the toroidal mode number. The physics mechanisms underlying those phenomena, however, have not been entirely clear. In this work, our recent NIMROD simulations of the MGI process in a tokamak have reproduced the main features of both events, which has allowed us to examine and establish the causal relation between them. In these simulations, the 3/1 and 2/1 islands are found to form successively after the arrival of impurity ion cold front at the corresponding q = 3 and q = 2 rational surfaces. At the interface between impurity and plasma, a local thin current sheet forms due to an enhanced local pressure gradient and moves inward following the gas cold front, this may contribute to the formation of a dominant 2/1 mode. Following the growth of the 2/1 tearing mode, the impurity penetration into the core region inside the q = 2 surface gives rise to the formation of the cold bubble temperature structure and initiates the final TQ. A subdominant 1/1 mode developed earlier near the q = 1 surface alone does not cause such a cold bubble formation, however, the exact manner of the preceding impurity penetration depends on the nature of the 1/1 mode: kink-tearing or quasi-interchange.