It could be a problem on the server you're downloading from. It could be that the phone modem (the thing in the phone that talks to the internet) is overheating.
Download the file using a PC, then try copying it over to the phone. If it doesn't download with the PC either, I'd suspect the server. (Or your modem or router - you could try calling your internet provider. Modems and routers overheat from heavy loads too, and downloading a 5GB file is a heavy load, unless you've got fairly new equipment (modem, router, phone). I regularly download files that are close to 2GB (monthly phone updates), and sometimes start hanging at the end - but if I just let it sit there, eventually it finishes. (These days, it usually takes less than 2 minutes, but if it hangs, it can take 15 minutes or so.)
I hope you're doing this on WiFi - if you're doing it on mobile data, each try counts toward your total data. (And even "unlimited" data is limited - at the "cutoff" point, you get throttled - sometimes down to 48KBPS, which can mean a day or more to finish the download.)