Looking at this line drawing of the evolution of the 747, a particular detail of the engines caught my eye. Moving from the earliest model (the 747-100) down to the latest (the 747-8), it appears the outer nacelle, which contains the bypass air, has grown considerably longer.
Presumably this added nacelle length incurs a weight penalty, so there must be some kind of advantage that makes it worthwhile. So what’s that advantage?
Noise suppression. Airports are under much stricter noise controls nowadays than when 747s became common in the 1960s. And passengers are more sensitive to noise nowadays. There may also be an incidental benefit to efficiency.
A Stack Exchange page relevant to the question:
TL;DR: It’s primarily to shroud bypass (and, in extreme cases, core) noise to meet or exceed maximum noise standards for the airframe. The longer nacelle increases weight and drag (presumably because the bypass air is in contact with the shrouding on its flow path for longer), but is superior for noise abatement and, in the case of a very long nacelle that reaches back past the core exhaust, some performance improvement from mixing core and bypass flow in the exhaust.
In the early 1970s I worked in an office/warehouse building near the St. Louis airport when the first 747 service started there. According to Google maps the building was 4.06 miles from the end of the runway, and every evening at 4:50 p.m. the entire building rumbled as the departing 747 passed overhead.