The incident came to light when the train stopped at the Kayamkulam station in Alappuzha district around 12 noon.
Police said the man, from Vellore in Tamil Nadu, appeared to be of unsound mind and had been taken into custody. He has been shifted to the Alappuzha Medical College Hospital.
According to witnesses, smoke started to come of the general compartment of the train, positioned near the engine.
It was found to emanate from the toilet. Railway officials quickly detached the coach and moved it to a distant place where the fire engines controlled the blaze.