In motorcycling, the petcock is a valve that controls the flow of fuel from the main and reserve fuel tanks to the engine. It is normally mounted on the left side of the bike, right around the rider's left knee, and normally has three positions: main, reserve, and prime/cutoff. On older bikes, especially ones with leaky carburetors, leaving the petcock open to main allowed fuel to leak out from the tank, into the engine and onto the floor. Many newer bikes don't have that problem, but it's good to know in case you need to troubleshoot.
It's entirely possible to manipulate the petcock while the bike is in motion, but doing so means riding one-handed while fumbling around below your seat. If, after time, playing with the petcock doesn't satisfy you, you can always adjust the idle speed screw.
Update: Transitional Man points out that older automobiles had petcocks, too.