Roughly speaking, two triangles are similar if one is a scaled copy of the other.
Any two congruent triangles are similar, but the corresponding sides of two congruent triangles are of equal length. That is, the triangles are similar but one is a scaled copy of the other by a factor of exactly 1.
The passenger is one side of a triangle, his shadow is another, and a line from the top of his head to the tip of his shadow is the third. The angle between the passenger and the line to the tip of his shadow is determined by the sun. We don't know it, but it will be the same for the train, so we can call it . Since we have two angles (the right angle between the passenger and his shadow) and , we can subtract them both from 180 to find the third angle.
Now, the train is also at a right angle to its shadow, and the position of the sun also forms the same angle between the train and the line from the top of the train to the tip of its shadow. Just as with the passenger, we can find the third angle by subtracting the right angle and from 180.
Now, the actual numeric values of the angles aren't important, but the fact that they are the same between the passenger-triangle and the train-triangle is the key. This shows that the triangles are similar.
Since similar triangles are just scaled copies of each other, you can scale each side by the same factor.
For example, suppose the train's shadow was 3m long and the man's shadow was only 1m. Then the train-triangle would be exactly three times the size of the passenger triangle.