So why are we shooting $20,000,000 missiles at $20,000 drones?
Missiles don't cost $20,000,000: AIM-120 ($1-$2 Million each), Patriot about $4 million), Iron Dome $40-$50 thousand).
Cost of the "drones" varies wildly depending on complexity, range, etc.
But you are correct, there is usually a cost disparity between cheap drones and the weapons used to kill them.
Is there a computer/AI controlled anti-aircraft gun system that might be better?
CWIS
Yes but remember that AA guns have
(a) a very limited range (effective out to 1.5 miles and maximum 4-5 miles).
(b) shoot very fast, meaning ammo depletes quickly and it takes time to reload.
(c) are used on the final point defense in a layered defense not as a one size fits all.
So when you look at an "effective range" problem you have to consider (a) is the unit defending self OR (b) is the unit defending others. If defending self the missile will be flying toward the area the unit is protecting and INTO the engagement envelope. However if the missile is flying over head or at range while traveling to another target, the "target" will likely be OUTSIDE the engagement envelope. The AA gun will likely not be in effective range for engagement leaving the missile (or drone) intended target vulnerable to the attack.
Meaning the only way (currently) to supply wide ranging defensive coverage to high value targets and civilians is via anti-missile missiles which also function as anti-drone to allow for wide area defense.
The AGR-20 Advanced Precision Kill Weapon System (APKWS) is a recent development that allows for modification of the unquided 2.75 inch rocket into a guided weapon that can be used for drone kills. It's still short range. However the converted 2.75 inch rocket is carried in a pod of 7 rockets each meaning aircraft can carry 42 rockets insteads of just a few expensive traditional air-to-air missles at millions each. The Unit Cost of an AGR-20 is about $22,000.
WW