Other than the cost factor I think
1) Current ships built or under constructions inherited from the naval fighting doctrines of previous 20 or so years when drone threats were insignificant, or were not recognised as a serious threat.
2) CIWS were deployed as last line of defense against air threats thus not mounted in large numbers. Countries with large navy can always send out a flotilla that is able to form layer air defense from 200km to 2-5km with long/medium range SAMs and guns. (This is before drones showed their destructive power in Ukraine).
Recognition of drones threat came late but in near future we may see navies start to retrofit anti drone weapons and counter measures. CIWS is just one of these, others could be laser weapons, more small and medium guns with air burst proximity fuze shells (25mm to 76mm), and manpad/ micro size guided missiles as well.
Machines guns that has no proximity fuze are generlly ineffective against drones since they need a direct hit to shoot down a drone, unless they are coupled with expensive track and fire sensors.