In most cases those making the decision really believe they can achieve comparable results by outsourcing while also taking advantage of global wage differences and also converting the continual overhead of personnel into just-in-time overhead that only has to be taken on as needed. This is not unlike the devops trend towards using cloud-based infrastructure.
The problem is that the thinking that you achieve comparable results by outsourcing is woefully naive. In-house teams have a vested interest in understanding the business problems as well as filling in the communications gap between what is asked for vs what is actually desired as an outcome. Outsourced contracted labor does not share those same interests. Additionally, when you outsource technical labor you MUST have the ability internally to create very good designs, specifications, and oversight/feedback mechanisms to ensure that you're getting what you wanted rather than what you asked for via sloppy communication. For those companies that have previously had internal teams and decide to transition to external resources they almost never have someone with that ability and in fact are unaware of the impedance mismatch between their asks and the results delivered by internal teams.
Outsourcing means trading the overhead of personnel costs for the overhead of a much more complex and difficult communications burden. It is extraordinarily rare that the company that opts to transition from internal to outsourced talent has the capability or even awareness of that trade, resulting in predictably poor results.