If the laptop was run hard (or for a long time, think hours), the HP machines will run the fan for a little bit after shutdown - usually 3-5 minutes to avoid thermal shock to the BGA chips under the CPU die. It doesn't do it if the chip isn't hot, but if the laptop was on for a long time that's normal. What isn't normal is if it's on for 20-30 minutes. Before you pack it, let it run for 5-10 minutes outside of your bag and it will typically shut off if the machine is just cooling things down. It's honestly more prevalent in Intel models and GPU equipped models over a lot of AMD machines, but even AMD models do it.
If it is on for 20-30 minutes, pull both the CMOS battery and primary battery to reset the BIOS and see if it continues. Use these guides to do it:
HP Elitebook 840 G8 Battery Replacement (Revivekit)
HP Elitebook 840 G8 RTC Battery Replacement
If it still happens, press ESC and then F2 -- run the system board test. If you just have the UEFI version it is limited but unless you secure erased a surplus PC it will probably still be there. Good thing is HP makes it available to reinstall: https://support.hp.com/us-en/help/hp-pc-...
crwdns2934105:0crwdne2934105:0
crwdns2934113:0crwdne2934113:0
crwdns2915270:0crwdne2915270:0
crwdns2889612:0crwdne2889612:0
2