The simple answer is if you're a pharmaceutical company and your gross profit margin is 75% (typical for a pharm) owning an electronic retailer that's making a profit margin of 3-5% (typical) drags down your PE ratio. That, in turn drags down your stock price and the net value of your company. Therefore, you sell off the electronic retailer company or spin it off on its own (both generate money). The goal of these companies is to make money for the stockholders by driving the price of the stock up. Also, if the stock price is dragged down by a "peanuts
" earner it's harder to issue more stock to generate the billions of dollars it takes to develop the next new drug.
Altruistically you'd think they're making good money so it's all good. But that's not how the world works. I've seen divisions of companies I've worked for sold off or shut down for not making the required margins the company required. They were still making good money... There are companies out there that aren't on the bleeding edge that make money by buying these divisions up, or buy the IP to keep making legacy products. But they don't need to spend billions on R&D. It's just a different company model.
Sometimes divisions are just sold off because they don't align with your overall goals. Another company may specialize in what that division did. This did happen to me once and it actually worked out great. We ended up working for a company that specialized in what we did. We filled a hole in their portfolio and our division grew.