It seems strange to me that ball valves are ball-shaped, when I would have thought a rotating cylinder with a transverse hole cut in the same way would be easier and cheaper to machine. Does anyone have any ideas?
Stopcocks use a cylindrical axle.
Ball valves use less metal and are more reliable because the seal is a simple circle, whereas in a stopcock an entire surface has to mate.
As far as machining is concerned, it is cheaper to make a ball than to make a cylinder of the same diameter and the same finish grade.
A sphere allows for sealing with simple o-rings in a flat configuration. This simplifies design, component acquisition, assembly, and repair and maintenance.
Not to be disagreeable, but the idea of calling a spherical valve a "ball valve" seems logical to me. To call a cylindrical valve a "ball" valve would be... more strange.
Actually, the term "ball valve" is distinguished as a kind of stopcock (that uses a sperical valve). But "stopcock" includes ball valves or the cylindrical kind of valve that you described. Stopcock is defined (by google) as: an externally operated valve regulating the flow of a liquid or gas through a pipe.
Cylindrical valves are the kind of valve that most faucets actually use (fancy cylinders are called cartidges or stem valves); but because ball valves are so popular (I guess), valves which are called "stopcocks" or "stop valves" tend to refer to the simplest cylindrical (or conical) valve; and less often does the term stopcock refer to a ball or stem valve. If you search for stopcocks online, you will probably find many cylindrical or conical valves which are used in chemistry apparatuses- especially because they are easier to disassemble and clean and they can be less prone to chemical and thermal damage.
But again, technically, a stopcock is a broader term which basically includes any valve, typically operated by hand.