Before these two fighters, Soviet aircraft were very angular and sharp pointed, like the Su-17 and the Mig-23/25. What made them switch to a much more curvy design style of the newer Soviet fighters?
I’m not sure if I’d call the Su-17 “angular,” but I get what you’re saying: the MiG-29 and Su-27 do indeed share a very distinctive “curvy” shape.
So, why? Well, the paramount principle we need to come to terms with is that form follows function, at least in military aircraft. And in modern combat aircraft the rule is that the aircraft is built around the engine, rather than fitting the engine into a pre-conceived airframe. Thus, the first decision which had been made in relation to the MiG-29 and Su-27—in 1970, when design work commenced—was that both would be powered by two engines. This arrangement offers more power and more survivability in case of combat damage to one engine.
What followed was the logical conclusion: the two engines would be placed in a side-by-side arrangement with corresponding air inlets. This decision already removed any possible similarity to the MiG-21 or Su-17. But of course, the MiG-25 (or the American F-15) proves that a twin-engined fighter can still be boxiness personified. Why, then, did the designers not take hints from the airframe of the MiG-25?
Again, because form follows function.
The Sukhoi OKB wanted an airframe able to store fuel and avionics more efficiently (or quite simply: more of it). The “integral layout,” as it’s known in Russia (i.e. the wings integrating cleanly into the fuselage), offered precisely that when compared to the boxy layout of, say, the Su-15. The engineers also wanted structural stiffness of the airframe, and again, the integral layout gave them stiffness through the use of leading edge extensions flowing neatly from the fuselage into the wing and stiffening the airframe longitudinally. Thirdly, they wanted maneuverability, and again the integral layout is superior. There are also other considerations relating to airflow within the engine assembly. You’d need to ask an aerodynamicist about those, but to the best of my knowledge, the integral layout wins out again by virtue of not having the inlets on the sides of the fuselage. Finally, there are some other minor advantages, such as providing convenient placement for a gun.
However, as far as is known, the MiG-29 was initially intended to follow the pattern of the MiG-25 (albeit smaller), complete with shoulder-mounted wings, and would have looked nothing like the Su-27. Perhaps it’s fair to say that the 29 would have looked like the love child of the MiG-25 and the American F-15 before hitting puberty?
The OKB-155 design bureau of Artem Mikoyan decided to examine other concepts and one of those was the one we’re familiar with today. It was fundamentally a very different project, even smaller and lighter than the original design (eventually it grew a little bit, probably mainly to accommodate more fuel) and featured the integral layout. This concept was championed by one Yakov Seletskiy and eventually was chosen for production.
The reasons why the integral layout prevailed in the MiG-29 are exactly the same as in the Su-27. There are some conceptual differences between the two. Designing the MiG-29 to be small, light and nimble made it very suitable for the front-line fighter role, operating over friendly lines and in shallow penetration of the enemy line. By the way, if you’re following the war in Ukraine, you will have seen how the concept of operating ca. 80 km behind the enemy’s front line still holds true. The Su-27, on the other hand, was more suitable to operations further beyond the front line. Still, both are fighters and thus have the same technical needs such as fuel storage, carrying modern avionics, being maneuverable and so on. And the integral layout provided all of that.
So, I hope it’s clear that there was no divinely pre-ordained reason for the MiG-29 to look the way it does, except for the paramount principle that form must follow function. The designers knew what they expected of their aircraft and ultimately chose the airframe which they believed brought them closest to their ideal goal.
Let me just point out that you should not think that previous designs were somehow wrong due to not following the integral layout. Those aircraft also followed the—let me pompously capitalize—Paramount Principle. They responded to specific needs (and specific limitations) of specific times and specific methods of waging war, which were dictated as much by the ideas prevalent in their home country as they were by what the expected enemy was doing. And a lot of that comes down to experience. As engineers work on more designs, as new engineers come in and are tutored by their older colleagues, as the scientific understanding of aerodynamics evolves, design iterations evolve, too, new ideas are conceived (sometimes by pure intuition) and brand new concepts are tested. And in the case of the MiG-29 and Su-27 the “curvy” style proved itself to be more promising than the “angular” style, but the style as such was never the end-goal.