I see it's to provide both CIWS, anti-FAC and GP capability.
It also undermines the need for 57mm and frankly makes 76mm main guns a bit pointless.
The extra range of the 57mm will help push engagements out, and be more useful for an indirect fire role.
But is it worth it?
Might as well leave defence to 40mm and FLAADS.
It certainly might appear that there is considerable overlap between 40mm and 57mm in anti-aircraft roles. But dropping 57mm in favor of missiles leaves quite a gap in the surface engagement solution.
That is, 57mm offers roughly 50% more engagement range than 40mm against surface targets. This, combined with the increases potential for guided rounds in the larger shell (ORCA and ALaMO, for example), suggests a clear benefit to having a bigger gun in the 57-76mm range for surface engagements. This isn't a new observation -- the RN adoption of the OTO 76mm gun on the Peacock OPVs back in the 1980s reflects the limitations of 40mm in "junk bashing" roles.
Having opted for 57mm, the next question is whether the choice of 40mm for secondary gun is better or worse than the alternatives. Those would appear to be either 35mm or 30mm firing air-bursting/AHEAD type rounds instead of 40mm with 3P proximity rounds. The choice between 35mm and 40mm seems to be a toss-up to me. Millennium is fast-firing but not much lighter and the ammo isn't that much smaller either. Going to 30mm might allow three rather than two mounts but complicates arrangements so you might not have more guns that can point in any given direction. And you sacrifice range against all sorts of targets.