Consider a device which converts kinetic energy into electrical energy ( just like piezoelectric generator). Now I install this on two trains of very high mass approaching each other (moving in opposite direction at 100 m/s). I am going to do two studies. In thile first study, I have two people in each train and ask them to shoot at the the piezoelectric generator installed in their own trains (assume bullet velocity is 25 m/s). They will get electrical energy equal to the kinetic energy of the bullet (assuming 100% efficency). In second study, I ask the people to shoot at the piezoelectric generators installed in each others trains. Now the bullets hit the generator at 125 m/s while in first case it is just 25 m/s. So I think that the electrical energy created in second case is very high when compared to the first case.. So energy can be created... I know this sounds crazy. But I don't know where I am going wrong.
Energy is not created. The difference between your two situations is in the final kinetic energy of the two trains.
When you fire the gun, it exerts a force on your body; to prevent your sliding across the floor, your feet exert a force on the train. Exerting this force very slightly changes the kinetic energy of the train. In addition, when the bullet is stopped by the piezoelectric generator, the generator has to exert a force on the bullet; by Newton's Third Law, the bullet therefore exerts a force on the generator. In order to keep the generator from sliding across the floor, the generator must also exert a force on the train, which will change its kinetic energy slightly.
When you fire the bullet into the generator on your own train, the force exerted by your feet and the force exerted by the generator are pointed opposite to each other (for example, if the generator is in the front of the train and you are behind it, then the force exerted on the train by your feet points backward, while the force exerted on the train by the generator points forward). In contrast, when you fire the bullet into the generator on the other train, the force exerted by your feet and the force exerted by the other bullet on your own generator are pointed in the same direction (the force on the train from each of their feet is pointed backward, and the force exerted by the bullet hitting the generator from the other side is also pointed backward).
So, in the first case, the two forces cancel out, and each train doesn't change speed or kinetic energy. In the second case, the two forces add together, and both trains slow down very slightly. The extra electrical energy you get in the second case is extracted from the kinetic energy of the trains.