It has been demonstrated by many experiments carried out over the last 60 years that in certain liquids a single millimetre-sized bubble will rise within an unstable path, which is sometimes observed to transit from zigzag to spiral. After performing several groups of direct numerical simulations, the present work gives a theoretical explanation to reveal the physical mechanism causing the transition, and the results are presented in two parts. In the first part, in which a freely rising bubble is simulated, equal-strength vortex pairs are observed to shed twice during a period of the pure zigzag path, and this type of motion is triggered by the amounts of streamwise vorticities accumulated on the bubble interface, when a critical value is reached. However, when the balance between the counter-rotating vortices is broken, an angular velocity is induced between the asymmetric vortex pairs, driving the bubble to rise in an opposite spiral path. Therefore, although there is no preference of the spiral direction as observed in experiments, it is actually determined by the sign of the stronger vortex thread. In the second part, external vertical magnetic fields are imposed onto the spirally rising bubble in order to further confirm the relations between the vortex structures and the unstable path patterns. As shown in our previous studies (Zhang & Ni, Phys. Fluids, vol. 26 (10), 2014, 102102), the strength of the double-threaded vortex pairs, as well as the imbalance between them, will be weakened under magnetic fields. Therefore, as the vortex pairs become more symmetric, the rotating radius of the spirally rising bubble is observed to decrease. We try to answer the question, put forward by Shew et al. (2005, Preprint, ENS, Lyon), ‘what caused the bubble to transit from zigzag to spiral naturally?’