When a moving bus brakes-to a stop: When the bus is moving, our body is also in motion, but due to sudden brakes, the lower part of our body comes to rest as soon as the bus stops. But the upper part of our body continues to be in motion and hence we fall in forward direction due to inertia of motion.
When the bus accelerates from rest we fall backwards: When the bus’ is stationary our body is at rest but when the bus accelerates, the lower part of our body being in contact with the floor of the bus comes in motion, but the upper part of our body remains at rest due to inertia of rest. Hence we fall in backward direction.