Machining is the general term for changing an object's shape by removing precise amounts of material with machine tools. Machining generally refers to metal, but most woodworking is also machining, and one can machine PVC, plaster, stone, glass, or any solid material. For reasons I'll get into, "soft" materials like aluminum are easier to machine than brittle materials like glass or diamond.
Machine tools include the lathe, the drill press, the mill (also called a milling machine), and to a lesser degree, the grinder. A lathe spins a part at high speeds (called "turning") while the tool or bit takes small amounts off of the part on each rotation, creating objects with axial symmetry. A drill press makes holes of various sizes in or through a part. A mill lowers a spinning tool to a captive part and drags the tool across the surface or edge of the part, making the most noticeable changes to a part's shape. Grinders and sanders are used to remove the burrs left behind by indelicate machines and molds, and are usually considered finishing machines rather than shaping machines.
Most modern machine tools are computer/numerically controlled, and can be told via a CAD program how to remove material from the part. The user pre-defines a tool path, and the machine duplicates it exactly. The process of combining computer-aided design with computer-aided machining is called CAD/CAM, but that acronym is used less and less, and CNC is taking its place.
Chatter, heat stress, and other hazards
When you're spinning a tool against a piece of material at thousands of rpms and simultaneously dragging it across the surface, there is a lot of friction and vibration. There are two ways this can manifest itself. If the force of the vibration is greater than the strength of the machine's arms and vise, the bit will bend slightly rather than dig any further, and begin to shake against the part. This is called "chatter," because that's what it sounds like. Not only does this cause your smooth cut to become jagged, but if unattended, it can throw the machine out of alignment. Unless there are safeguards built into the machine, this can be expensive to fix. If the material is brittle, then you need to make sure the frequency of the vibration is higher than the material's resonant frequency, and that the force of the bit pressing against the material doesn't stress it too much, or your material will chip or simply shatter. If the part you're machining is going to be load-bearing, then you want to make sure that the surface you machine doesn't get too hot and create heat stress in the part, or you could get a weak spot right where you don't want one. Most of these problems can be solved by adding coolant or lubricant to the mix: by keeping a constant stream of a thick oil with a high heat capacity pouring across the interface between the tool and the part, you can cool down both of them, and reduce the amount of friction creating the heat. With a catch pan, a filter (to keep the metal shavings out) and a pump, you can recycle a small amount of oil for hours. In many modern CNC machines, especially large ones making many copies of the same part, the pump is also controlled by the machine, and an infrared sensor reads the tool temperature, ensuring that the part stays cool.
The cost of tolerance
Tolerance is important in machining; both the tolerance of the work, and your ability to tolerate getting oily, getting slivers of metal in your skin, and watching several hours of work and possibly a thousand-dollar work piece go down the drain because you took off an extra mil--that's one thousandth of an inch. Because of the difficulty, a machinist can charge anywhere from $50-$500 for an hour of his work (perhaps more for the work of a CNC machine, since the machine must be programmed), and depending on the complexity and tolerance you want, the number of hours can approach forty--a full week's work--for a part smaller than your head. You bring the material (or pay him to order it), you bring the blueprints, and if you've got a good machinist, he will review the blueprints with you to save you both time and money. Is there an exceptionally tight tolerance in a corner for a reason? Do you have the part that this one must fit? If he can do your part in fewer hours, he can do it for you more cheaply, and both of you will be happier with the end result.
CNC machines are, on the other hand, golemic in their interpretation of your orders. My first program took six hours making a wheel hub on a CNC lathe; my second made an exact duplicate in two hours. I realized as I watched the first one that I was taking too little off at each pass, and moving across the part too slowly. Too fast, and I might have broken a tool or shaken the machine out of tolerance with chatter. The tools or bits can be as much as $50 for diamond or carbide bits; re-aligning a machine costs hundreds or even thousands of dollars if the machinist on staff doesn't know how to do it.
...but it's fun!
Despite all these costs, the risk for injury, and the difficulty of making a part that will fit exactly right the first time, machining is not just a job. Many people treat machining as a hobby, and have extensive machine shops where their neighbors might have a wood shop. Having done a little machining, I have to admit that it's very rewarding to take a slab of metal and sculpt it into the shape you intended. Hearing the snick of metal on metal as your piece slips into place in whatever you're constructing is a thrill that makes the sweat and dirt worthwhile.
For most of the 20th century, machining was used to make prototypes before deciding how to mass produce the part. Recently, however, new methods have eclipsed it in places. Rapid prototyping and photolithography are, to some extent, the opposites of machining: material is added layer by layer to create a 3-D shape. I won't go into any more detail about them here, except to say that photolithography can create parts that were impossible to make with traditional machine tools.