1. Inventor makes some new and non-obvious improvement to prior art. "I did A with B using C by way of D"
2. In patent application, the patent editor tries to widen the claim to. "A with B using C", "A using C by way of D" or even all the way to the silly and obvious "A".
3. Patent examiner rejects most claims. Some widened claims, beyond what the inventor considered to be his invention, are accepted by the examiner because they really are novel and non-obvious. The patent is now more valuable too inventor (or, more often, his employer) because it covers more things.
This process of trying to extend the claims by making them more general is quite mechanical. Patent editors do it almost automatically and without really trying to think too hard if the result makes much sense.
Sometimes overworked examiners accept silly over-generalized claims on an application and it makes it into a granted patent. It is a serious problem with the system (or a win, if you are the submitting company). Such claims may be overturned later in court, but most patent lawsuits are settled out of court, never challenging such claims because of the costs and risks involved. This makes such over generalized patents a weapon for bullies.
Sometimes, if you are a high-profile company that is under the public eye, people will pick such unexamined claims in a patent application and make them into a silly headline "company X tries to patent obvious thing Y!!!".