When you make a financial investment you are trying to make money based primarily on the future success of (a) business enterprise(s).
When you gamble money you are trying to make money based primarily on chance (such as a bet on a roulette wheel) or where the odds are manipulated to insure insure the total return to those gambling on an event will be less than the amount they bet (such as a parimutuel betting on a horse race) or both.
That is what I consider the most fundamental difference.
Other people consider the most fundamental difference is that most financial investments make money while most gamblers lose money. However, that is far from universal. For example, futures and options are known as "zero sum games" for one person to make money on a futures or options contract another person has to lose the same amount of money on the same contract. If you trade individual stocks it is not uncommon for a person to lose money on some stocks. However, as another answer pointer out, the overall stock market has a strong history of making money for investors over a longer time period.
Similarly, there are gamblers who consistently make money gambling over longer time periods. Blackjack card counters, professional poker plays, and a very small number of sports bettors are examples.