Many cyanobacteria, which use light as an energy source via photosynthesis, show directional movement towards or away from a light source. However, the molecular and cell biological mechanisms for switching the direction of movement remain unclear. Here, we visualized type IV pilus-dependent cell movement in the rod-shaped thermophilic cyanobacterium Thermosynechococcus vulcanus using optical microscopy at physiological temperature and light conditions. Positive and negative phototaxis were controlled on a short time scale of 1 min. The cells smoothly moved over solid surfaces towards green light, but the direction was switched to backward movement when we applied additional blue light illumination. The switching was mediated by three photoreceptors, SesA, SesB, and SesC, which have cyanobacteriochrome photosensory domains and synthesis/degradation activity of the bacterial second messenger cyclic dimeric GMP (c-di-GMP). Our results suggest that the decision-making process for directional switching in phototaxis involves light-dependent changes in the cellular concentration of c-di-GMP. Direct visualization of type IV pilus filaments revealed that rod-shaped cells can move perpendicular to the light vector, indicating that the polarity can be controlled not only by pole-to-pole regulation but also within-a-pole regulation. This study provides insights into previously undescribed rapid bacterial polarity regulation via second messenger signalling with high spatial resolution.