When you have information/know the outcome in advance.
Gambling is just hoping probability comes up in your favor. You'll lose over the long term, but you could win an individual bet. Neither is under your control or can be influenced by any "inside" information. The dice don't care what you know or don't know, and bets don't change the payout.
Granted some types of "gambling" such as horse racing or sports in general are more like a prediction market than a true bet against odds, where knowing something that the general betting public doesn't know could be used to your advantage.
In sports? Perhaps you just observe a player get injured in a car accident and bet based on that.