Earth rotates around its axis from West towards East. So the position of Sun visible to us changes continuously from morning to evening.
The length of shadow depends on the angle that the parallel rays from the Sun make with the horizon. At noon this angle is 90 degrees. So shadow length is 0.
At Sun rise and sun set, the Sun is near the horizon and the angle made by the Sun rays with the horizon is very small. It makes the shadow length very large.
It is because of the rectilinear motion of Sun rays, ie., motion along a straight line.