example: I can see a package "XYZ" has been installed. I want to find out which package installed XYZ because it's one of its dependencies.
Thanks
A single package can be required by multiple different packages so it's not always obvious, specially if you installed a bulk of them.
Ways to check it:
sudo dnf repoquery --whatrequires package or rpm -q --whatrequires package
Simply running sudo dnf history package| egrep -w 'install|upgrade' will show you all the operations with the package and by inspecting them you can infer which other packages required the package.
Also, you can simply try uninstalling the xyz and see what it leads to: sudo dnf --assumeno remove package or rpm -e --test package
dnf history details, but dnf repoquery --whatrequires package will show all the packages in the repo that depend on package (see --whatrecommends, --whatsuggests, etc., as well). rpm -q --whatrequires package will also show the installed packages that depend on package.