Mass of bob is 1 kilogram. Let the angle of Bob with the normal be $\phi$ the force acting on bob along the axis of motion is $$mg\cos(\phi)$$ Now as this train is having zero acceleration, bob must move with zero acceleration so the force acting on bob due to gravity ie $$mg\sin(\pi/6)$$ Therefore $mg\sin(\pi/6) = mg\cos(\phi)$ Then phi must be $\pi/3$ but the answer my book has is different. What's the mistake I'm making?
There is no acceleration so it does not matter whether or not the train is moving.
Draw a Free body diagram for the bob. The answer should be staring you in the face.