Many things to know in investment, and to understand it will take a long time. But I do not deny that many lay people think this is the same, like my experience, for example, when I first knew and did investment, many of the people I knew thought I did gambling under the pretext of investment, but after I explained to them as detailed as possible , finally they can understand. And you are right, the reason why they consider gambling and investment is the same thing because there is money that I put as the initial capital, and I can only smile when I hear that.
It is not a thin line that separates gambling and investment. They are too distinct that we can tell that they are different even from afar. The noticeable difference between the two is control where gamblers have little to no control while in investment the control factor is high. Risk in gambling is very high while in investment risk can range from low to medium and the same goes for the potential to loss.
We can read more differences on this site: https://www.mandg.co.za/insights/articlesreleases/whats-the-difference-between-investing-and-gambling