In a moving a vehicle, like a bus, the motion is not uniform. The speed of the vehicle varies and there are instances of sudden brakes or turns throughout the journey.
Due to inertia, the luggage kept on top will resist any change in its state of rest or motion or direction and will have a higher tendency to fall.
Thus, it is secured with a rope to prevent it from falling.