Not a good idea to rely on Apples Recovery Servers.
Once you get El Capitan reinstalled you should then consider upgrading to a newer OS.
If you want to upgrade to a newer OS then I would recommend you upgrade to macOS High Sierra first as this will prepare your mac for the new APFS file system which the newer OS's run on. A lot of people have reported their macs stalling while upgrading to the newer OS's from older OS's like El Capitan.
The certificates for several of Apples OS's expired in October 2019, Apple haven’t bothered getting these updated on
their Recovery Servers with valid certificates.
This may be the problem you are experiencing.
Try this workaround, we are going to set the time and date on your mac to a date previous to the expiry date of the certificates.
Connect your mac to your router via cable, not WiFi
Boot to your Recovery HD, click on Utilities in the menubar select Terminal.
Make sure WiFi is switched off, it can reset the date back to today.
Enter a new date, for example or just copy and paste
sudo date -u 011421002017
press Return
enter your password
press Return
If Terminal returns an error saying sudo : command not found, then try again without sudo.
just enter
date -u 011421002017
press Return
You won't be prompted for a Password if you did not need to use sudo
Once the date has changed you can quit Terminal.
Now try downloading the OS.
Click on Install OS X, press Continue.
If this works then when the OS is installed and booted up you can Open System Preferences> Date & Time
and reset the time back to today.
Once you have got El Capitan back on your mac then you can upgrade to a newer OS.
For macOS High Sierra, Mojave and Catalina,
Open Safari and click on this link,
How to get old versions of macOS – Apple Support
Go to Check Compatibility to see if your mac qualifies for the OS upgrade you want.
Then go to the Download OS section and click on the OS you want to install.
Before upgrading make a full back up of your Mac.
Check that third party apps you use have updates available for the new OS.
https://roaringapps.com
Check that your printers/ scanners etc have updated drivers and software available for the new OS.
Connect your mac to your router via cable rather than rely on WiFi.
Do not use your mac while it is downloading
and do not use any other devices that share the same internet connection.
If the App Store says ‘Open’ then it is detecting a previous download of the install app
go to the Applications folder locate Install macOS ******.app.
Move it to the Trash, empty the Trash.
Restart, click on the link again, the App Store should say ‘Get' or 'Download'.
If you want to or are able to install Big Sur, open Safari and click on the link below.
How to upgrade to macOS Big Sur - Apple Support
If you are considering upgrading to Catalina or Big Sur be warned they do not support 32bit apps.
Your Mac is probably running 32bit apps and these will need to be updated to 64bit apps,
some updates may be free, some may be paid. Use this app to discover which apps you have
are 32bit, https://www.stclairsoft.com/Go64/ then contact the developers of the software to see
if they are offering 64bit updates.