Modern actors aren't as willing to sacrifice their health for muscle as their historical counterparts, especially because the lean look is preferred over the muscle-bound appearance of yesteryear. Thus, (with rare exceptions, like Christian Bale between
The Machinist and
Batman Begins), what you see on screen today is hard-earned through hours a day in the gym, a
very regimented diet, and hydration timing.
Generally, to get to the level of single-digits body fat you see on screen, you're looking at 3-6 months of clean eating (or more, depending on the actor's physique when they land the role), meaning among other things, no alcohol, no sweets, and lots of eggs or chicken meals. Someone being paid a few million dollars can afford to pay a nutritionist to custom-design a diet to meet specific appearance goals, a and they have a huge incentive to stick with that diet. For example, Chris Pratt had to give up beer, pizza, and all dietary pleasures for six months to go from being the fat guy on Parks and Rec to the main hero of Guardians of the Galaxy.
On top of the diet, the actor is spending hours on near-daily exercise for several months. Chris Hemsworth eschews cardio for pure muscle-building, but Paul Rudd and Kumail Nujani each spent a year preparing for their Marvel roles, using a blend of cardio and full-body workouts (as, in contrast to Thor, Ant Man and Kingo have lean physiques but neither actor was particularly athletic when cast), while Pratt spent nearly 6 hours a day, 6 days a week, for over 6 months on cardio activities to cut weight for the first Guardians movie (as he already had the muscle for the character underneath his excess bulk and just needed to reveal them).
But the real trick to the "cut" look on screen is dehydration; actors don't drink for several hours before shirtless scenes, which makes them appear thinner and more defined. (In several interviews, Kumail Nujani talks about nearly passing out after several filming several shirtless scenes for The Eternals, which required him to limit water consumption for nearly 12 hours before shooting.) This is something you can actually try yourself at home: take a before pic, spend a few hours on a long cardio activity like running or biking, and then take an after pic before you rehydrate. You will appear thinner and your muscles (if they were visible beforehand) will appear more well-defined, even though they aren't any bigger.