When you upgrade packages on RedHat based systems, the newer package replaces the older one except for install only packages e.g. kernel packages. Upgrading kernel package(s) with yum, dnf and even apt leaves 3 older versions—by default—of the kernel package(s) on the system. This can be useful in cases where you need to use to an older version.
Once you have more than 3 versions, yum & dnf will clean the older versions of the install only package(s). To retain more than 3 versions, set
/etc/dnf/dnf.conf to a number that you want, e.g. keep 5 versions:
To keep all older kernel packages forever, set
installonly_limit to 0 i.e. never remove older versions of install only packages.