Investors & landlords

I guess it's not clear to me why I would be taxed here even if I was just diversifying my portfolio.

 

It is a taxable gain because you made money when you sold the stock.   What you did with the money does not matter.