Of course and it's totally different from gambling to be honest with you. Gambling requires luck to win but investment you need patience, knowledge, fundamentals, technical analysis you name it I mean you work for it because it will give you gains if done correctly while gambling itself doesn't need those things because it is purely based on luck.
Depending on how you use gambling, if you play a game like Slots it is indeed entirely up to luck.
But if you do sports betting you can do research according to that data and you can determine which team will win, lose or draw.
Again with the discussion of trading, trading can also be considered like gambling if you trade only based on instinct or feeling, without knowing the basic knowledge of trading.
As in futures trading or Binary Options trading which is completely the same as gambling.