A middleman is someone who works buying goods from one source and selling them to another. For example, if you are selling your house, your real estate agent acts as the middleman between you and the buyer.
Anyone whose job involves buying and re-selling can be called a middleman, although sometimes the thing being sold is some kind of service rather than physical goods. One example of a middleman is a wholesaler who buys fruit and vegetables from farmers and then distributes them to large supermarkets. While sometimes it makes more sense for farmers to sell directly to stores, a middleman can simplify the process.