The definition of gambling is clear. That is to bet on an
outcome which you are uncertain of. To bet on an outcome with no
basis of forcasting the results.
In the scenario you have just described, it could be considered
maybe 20% investing and 80% gambling. Let me explain.
If you commit time to find out about the diet which the horse
consumes, the number of muscles in the horse, the psychology of the
horse and the bond betwen the rider of the horse, etc etc you are
actually creating a good chance for yourself in the sense that you
have a reasonable basis to predict the outcomes.
But one must not forget that when you make a bet on the horse, what
do you get? You get only a chance to win money. If another horse
were to win, you lose 100%. That is to say, when you commit money
to bet on horses, you do not get anything physical in return
In the case of buying shares or financial products, you get
something physical in return for the money which you commit. When
you buy shares, you are buying part of a company. You become an
investor. The shares you bought carry voting rights which you may
use to influence decisions made in the company.
So in investing, you get something for something. In gambling, you
get nothing for something.