This is the result of different of the simultaneously , The simultaneous on the train is different than that on the ground.
The change in mass is telling you that mass=energy, the total energy of a particle / object is mc^2, where m is the mass of the object (not rest mass). As you increrase the speed of the object, it gains in kinetic energy, as energy is mass and vice the verse, you are increasing the total energy (mass).