The Raspberry Pi uses 3.3V logic. And has a limit on how much current a GPIO pin can supply. It would never be able to turn on a 5V relay if directly connected to a GPIO pin.
It will also likey damage that GPIO pin. Also, if you feed a 5V signal into a GPIO it will damage the Pi
Your plan to use the Automation Hat sounds to me like a good idea. You can either use the onboard relay, or one of the sinking outputs to ground / turn on the relay you have now.
To be clear, I don’t have any relays now. Just that when I searched for a relay that could control a 5V device all I found was “horrors” about using a relay designed for Arduino with the Pi.
Since this is a Pi Hat I assumed it would be safe for the Pi but I wanted to be sure that “up to 24V” meant I could still control something that used a MUCH lower voltage (which, again, is coincidentally the same voltage as an Arduino which generated a lot of “white noise” in my search results)