In the non-inertial reference frame that is the accelerating train, the bob experiences a fictitious force $-ma$ where $m$ is the mass of the bob and $a$ the acceleration of the train. This force is proportional to the mass of the bob. Assuming the bob is initially hanging vertically, as soon as the train accelerates, the initial displacement of the bob in the $-a$ direction is instantaneous and is the same regardless of the mass, since the force is constant and proportional to the mass. (This is similar to two objects of different mass dropped from a height; the objects travel the same distance in the same time- neglecting air resistance- since the force of gravity depends on the mass.)
For the pendulum motion in the accelerating frame, see the answer by @joseph h and also Time period of a simple pendulum in an accelerated frame on this exchange.
The following was added based on comments.
Assume the bob hangs vertically before the train starts to accelerate. When the train starts to accelerate there is instantaneous relative movement of the bob relative to the train seen by observers both on the train and on the ground. To the observer on the train, the train is not moving and the bob moves due to the fictitious force. To the observer on the ground, the bob is stationary and the train moves.
In both cases the relative motion of the bob relative to the train is the same and the bob continues to move relative to the train until a component of the tension force (a) counters the fictitious force for the observer on the train and, equivalently, (b) equals the acceleration of the train for the observer on the ground. The bob moves until it reaches a new equilibrium position. If the bob is "tapped" (slightly displaced from equilibrium), it acts as a pendulum about the equilibrium position. See Time period of a simple pendulum in an accelerated frame.