I am afraid I don't understand exactly what your teacher means, but I think that the main dangers of standing close to a moving train (particularly a fast moving train) is
- air - movement of air and/or turbulence in the air caused by the train passing may push/pull you towards the train
The Bernoulli effect is relevant here. If the air between you and the train is moving quickly in the same direction as the train and the air on the other side of you is stationary (or at least not moving so fast) then the pressure of the air near the train will be lower than the pressure on the other side of you and there will be a net force pushing you towards the train. I suspect the closer you get to the train the greater this force would become, which would make it feel as if you were being sucked into the path of the train.
There are also some trivial practical considerations about standing close to moving train.
- something sticking out from the train may hit you
- if you move the wrong way you could hit the train