Some types of investing, such as day-trading, are very much like gambling. The difference really comes down to intent.
Wise investors buy partial ownership in a company in the hopes of making money over time, which can be a sound way to plan for the future. Gamblers risk money, which they know they will probably lose, in the hopes of making money quickly. There are differences, however, between gambling at a casino or buying lottery tickets, and buying stock. The argument goes that, since stocks are bought in the hope (not guarantee) that they will increase in value, it is a form of gambling. There are those who oppose investment in the stock market, saying that buying stocks is the equivalent of gambling.