Why would a machine need a governor? Let's do a thought experiment:
Let us suppose that our steam engine is running a lumber mill and that a really big log has just run into the blade. The blade bites in and slows down the blade (and our steam engine) due to drag. Without a governor to increase steam flow to our engine, the blade would eventually to slow to a standstill, because until the blade bit into the log, only a tiny amount of steam was necessary to keep it moving.
With a governor though, as the sawblade (and steam engine) slow, the governor detects the loss of speed and increases steam flow to keep the engine running at the correct speed.
So How did these early governors work? A small shaft driven by the steam engine spun the balls. If the machine spun faster than desired, centrifugal force would make the balls swing outward. Since they were connected by a linkage to a collar. The collar lifted up. This collar would be connected to the central disc that controlled all the steam inlet and exhaust valves, to close them down.
Here is another image, which better explains how a governor controls the speed of an engine.
This was an important development for stationary engines in the era before the electrical grid, because each machine required a reliable means of maintaining stable speed. If not for a governor to increase steam flow, even a slight increase in load would eventually bring the machine to a stop. On the other hand, a drop-off in load without reducing steam flow could cause the machine to overspeed and damage itself.