Different design goals
AVIF is a still frame from the AV1 video codec. Video codecs are optimised for delivering acceptable quality at low bitrates across enormous volumes of content, and AVIF inherits that: it is exceptional at making small files that still look coherent.
JPEG XL was designed as an image format from the start, by the committee that produced JPEG. Its priorities are high-fidelity photography, lossless storage, fast encoding and a migration path from the billions of existing JPEGs.
So they are strongest in different places, and comparisons that pick a single bitrate and declare a winner are mostly revealing which end of the range they measured.