The villains of the piece change as the economy changes. At one time it was money-lenders, then corn merchants. In modern times speculators are up there with bankers in popular dislike. Speculators are commonly perceived as people who add nothing to a product, and often as people who profit from the hardships endured by others. They are seen to buy cheap in the hope that the price will rise, then sell at a profit without having added to or improved whatever it was they speculated on. In fact speculators often provide a useful service. They can take the burden of risk that others might find difficult to deal with. The speculator who buys a farmer's crop in advance gives the farmer the certainty of a price. Farming is an unpredictable activity, and the market price when the crop I harvested might be higher or lower than that agreed price. The speculator hopes it will be higher and takes the chance, but the farmer prefers the certainty of a known price that enables him to plan his affairs.
When speculators buy or sell commodities hoping to profit from price changes, they dampen some of the fluctuations. If they bet on a future shortage, they will buy now in the hope of selling for a higher price. If enough of them do it, the effect of buying now is to raise the price now, signalling to users to curtail their use, and to producers to bring out more supply. The same happens in reverse if they bet on a future glut by selling.
Businesses that sell to other countries face the uncertainty of not knowing what their goods might fetch in foreign currencies at the time of their delivery. They can smooth this by buying or selling currencies in advance from speculators prepared to take a punt on future changes in exchange rates.
The invisible service that speculation adds to goods is risk management. It is a valuable service, but because people cannot see it, they see it as money for nothing. Always there will be populist politicians prepared to trade on their resentment and propose tough laws to curb an essential service that helps markets to work more efficiently.