The 737 was designed using light tables and slide rules, to use low-bypass turbofans and direct controls with avionics only on board to optionally aid the pilots.
The A320 was designed in CAD and using CFD, with full digital fly-by-wire, and designed from the start for high-bypass turbofans.
Both designs have been updated plenty since, but because the basic design is much more modern, the A320 is much more amenable to being updated. There are elements of the 737 design that still exist on every new MAX coming off the line that would completely doom the certification chances of any new design, but are still there because they got grandfathered in for 737.
The wonder is not that the A320 finally caught up in sales, it's that the 737 can still be legally sold.