Termites are attracted to light when they are swarmers.
Light Swarming Behavior Unique to One Caste
Like the ant colony, the termite colony has castes to perform different functions. The termite colony consists of three castes: the soldiers, the workers, and the reproductives. It is the reproductive caste that engages in swarming behavior.
The Reproductive Caste Are Swarmers
The reproductive caste consists of alates, de-alates, queen and king, and neotenics. The alates are winged males and females that will emerge from a colony in massive swarms when they are ready to mate. Warmer temperatures and rainfall generally trigger this swarming behavior. These swarmers only fly for a brief period, but during this time, they are highly attracted to light. After a short flight, they will drop to the ground, choose a mate, and pull off their wings becoming de-alates. They will then pair off and attempt to start a new colony where they will become the king and the queen. 
Is Light Swarming Behavior Unique to Particular Species?
Species of both dry-wood termites and subterranean termites swarm at night and are highly attracted to light. 
Swarming Not Always a Concern
Luckily for homeowners, swarmers have a very slim chance that they will be successful in their mission to set up a new colony. Without the protection of the colony, the winged termites fall victim to predators such as birds and dragonflies. If they do survive predation, there is a high probability that they will die of starvation or dehydration. 
That Swarm May Just Be Ants
Interestingly, ants also exhibit the same swarming behavior and are often mistaken for termites. [%] All ant species are capable of producing swarmers if the conditions are just right. The swarmers perform the same function that they do in the termite world. There are several key differences in physiology that set the two apart. The ant has elbowed antennae—the termite’s is straight, the ant has a narrow waist—the termite’s is thick, and the front wings of the ant are longer than the back—the termite’s are the same length. 
 Chair of Forest Zoology and Etymology
Termite Lifecycle and Caste System
 University of Florida Cooperative Extension; Vivienne E. Harris, Ph.D
Comparison of Subterranean and Drywood Termites
 University of Rhode Island Landscape Horticulture Program
 County of Los Angeles-Agricultural Commissioner
Termite and Fumigation
Cornell University Cooperative Extension
Eastern Subterranean Termites
Iowa State University Cooperative Extension
Ant Swarmers Fill the Air