the mud particles stick to the wheel when they are wet. but, as the force of adhesion which causes the mud to stick to the wheel isn't strong enough to provide centripetal force required to keep the mud stuck to the wheels. so, due to inertia of motion, the mud flies off in a direction tangential to the motion of the wheel.
the mud can fall on the rest of the vehicle of the body, the people standing nearby or the vehicle itself. solid bricks or wooden plank act as a mud guard which stops the flying mud which keeps everyone clean and safe.