The 787 was a risk-averse management boondoggle
Rather than being an Apollo-style moonshot, the 787 was more of a Soviet-style moonshot. The top management at the time (and still today) wanted to hurt the Seattle-area mechanics' (assemblers') union, which had a history of striking (only some of the time because management was trying to screw them over). Thus, they decided to move parts of the 787 work out of the Seattle area, to "partner" companies around the world. As a bonus (management thought), they required the partners to use their own money, not Boeing's, to design their part and build their tooling and factories. What could possibly go wrong with outsourcing big chunks of design and production?
The 787 fiasco was the result. It turns out the partners were nowhere as good as Boeing's in-house Seattle-area staff at design, at assembly quality, and at identifying and solving the early-year assembly teething problems. In fact, IIRC, the Italian partner won't be allowed to work with Boeing again, and wings, the most critical and proprietary part of the design, won't be allowed to be designed by non-Boeing staff ever again.
Vought, a US subcontractor, not only produced delayed structures, but incomplete ones, even after a few years of intensive on-site help from Boeing employees, so in the end Boeing had to buy all the Vought plants and employees doing the Boeing work and bring them in-house to get the work done right.
The 787 was a fiasco because top Boeing management tried to play small ball on a moonshot project. They failed to realize that their scheme reduced shorter-term capital expenditures, but at the cost of vastly increased integration risk -- the risk that the parts wouldn't fit and function properly together once they were put together to form a plane in Seattle. In the end, initial capital savings were overwhelmed by the extra capital, labor, and airline compensation costs of not getting the project done right the first time.