There are two key differences between trading and gambling.
Trading is about finding an edge or strategy which over time will produce a profit, in gambling it is usually difficult to quantify the edge or the casino (“the house”) has the edge.
Secondly, serious traders will often have a well developed trading plan or system that dictates how they operate. Gambling is generally more often “ad-hoc” and does not operate to a well thought out plan or process.