Aircraft programs are risky. You don’t know how much it is going to cost you in the end and you don’t know how many you sell. In order to offset some of the risk and avoid bankrupting the company with a single program failure companies typically engage in “risk-sharing”. Simply put, this is where they engage partners to build part of the aircraft (and front the R&D expense) in exchange for the chance to benefit from a successful program. This reduces your financial exposure and also offloads the need to ramp up technical and manufacturing operations so severely.
If you look at the diagram below it shows how Boeing parceled out parts of its 787 aircraft in order to spread out the workload and mitigate risk ( it resulted in other problems, but they aren’t relevant to this question). This just shows the major components, frequently hundreds of partners are involved in a major aircraft program. All of the major manufacturers do this.
What does this have to do with engines ?
Engines can account for as much as a third of the overall cost of the completed aircraft. As such they represent a major financial outlay and risk to a company. They also require technical knowledge which is highly specialized yet different from what is required to design an airframe. These two facts make them ideal candidates to be outsourced by manufacturers.
As a rule manufacturers don’t build there own engines or landing gear, these two items are too specialized for even the largest company to efficiently take on. Having engines made in-house would increase financial risk, increase technical risk and you would likely be unable to sell them to any external customers, so you would have limited marketing options. In short, building your own engines is everything aircraft companies are trying to minimize on a program.
Source : Quora