Whether you trade or invest, your capital is at the whim of markets and hence there is a risk-return tradeoff you should be mindful of. However, when it comes to investing vs trading based on risk, trading is riskier.
Investing as a habit takes time to develop and reaps results in long term. The risk-return tradeoff is comparatively low when the period of holding is less, however, if stocks are held for a long time, the compounding effect of dividends and interests can fetch much higher returns. The risk-return tradeoff extends until you think you have realized the maximum gain possible.
The indispensable reason why trading is riskier is that it implicates super quick short-sighted decisions, which may well be in your favor or against. Needless to say, trading can oscillate between highs and lows quite rapidly. The risk-return ratio usually treads around 1:1 to 1:4.