Newton’s third law:
For every action, there is an equal and opposite reaction.
This means that if object A exerts a force on object B, object B exerts an equal force in the opposite direction on object A.
In the water sprinkler, the sprinkler is applying a force on the water, accelerating it as it flies out of the sprinkler. At the same time, the water exerts a force on the sprinkler, causing it to accelerate backwards, which is why it rotates.
This also ties in with conservation of momentum and conservation of energy.