"I am thinking to invest" or "I am thinking investing"?
I wouldn't use either one; I'd say "I'm considering investing in stocks". One does not "invest into" anything (in my experience). The first sounds at best somewhat stilted.
Your first sentence is a fairly common structure, but it is somewhat informal, to say the least. I would not recommend non-native speakers experimenting with such non-standard forms.
The second sentence is simply ungrammatical.
The standard phrasing is...
I am thinking of investing in stocks.
When you are considering a possibility or advantages of doing something, you use think of.
He was thinking of becoming a zoologist.
I am thinking of investing my money.
I am thinking of investing in stocks.
"I am thinking investing into stocks" needs a second part to make it grammatically valid. For example:
- What's up, John? You seem absorbed.
- I am thinking investing into stocks is a risky thing nowadays. I'll cancel the deal.
Which is contracted from "thinking that/[of] how investing...".
But, in general, there are better choices to express the same meaning.