We can see that now most latest airplanes by Boeing and Airbus like 737 max or A350 have twin engine configuration instead of 4 engine. And many airlines are discarding iconic 747s and A380s. What is exactly reason for dying popularity of these iconic jets?
Cost and reliability.
At the dawn of the jet era, no jet engine was powerful enough to use just two. They also tended to fail a lot, so even once two was powerful enough, one still wasn’t, so quad-jets ruled the skies.
However, power improved quite rapidly, and it soon became practical to build large twin-jets, which were significantly cheaper to buy and to fly. But they were restricted to land routes because the engines still failed too often.
This led to the creation of tri-jets, which were conceptually just twin-jets with a spare engine in the tail; regulators deemed that safe enough for oceanic routes, and quad-jets mostly died out.
Then, eventually, the engines got powerful enough that twin-jets could fly several hours on one engine, and reliable enough that it rarely happened anyway, so regulators decided twin-jets could be used on oceanic routes, and tri-jets disappeared overnight.
The sole remaining case for quad-jets was aircraft so ridiculously large/heavy that they simply couldn’t fly on one engine, no matter how powerful. That is where the B747 and A380 fit in.
The B747 did well in that niche for decades. However, by the time the A380 was launched, the inherent problems with hub-and-spoke networks had become glaringly obvious, so the industry had started shifting to more point-to-point routes that were better served by smaller aircraft. After initial flurry of orders for the A380 (and remorse when buyers had problems filling them), the market dried up, and production ended for both aircraft.