Gayen was born in a Bengali Kayastha family in Dhaka, Bangladesh. He completed his BSc (Hons) and MSc in physics from the University of Dhaka in 1977. In 1984, he received his PhD in physics from the University of Connecticut. His thesis was titled Two-photon absorption spectroscopy of the trivalent cerium ion in calcium fluoride.