Click on this link, How to upgrade to OS X El Capitan - Apple Support
Go to Section 4 and then click on Download Mac OS X El Capitan.
This will download a file called InstallMacOSX.dmg to your Downloads folder.
When the download has completed, double click on it and a Disk will appear on the
Desktop, open that and double-click on the InstalMacOSX.pkg.
This will open the installation window, proceed and this will make a Install Mac OS X El Capitan.app
in your applications folder. you can double-click on that to start the installation procedure,
you will be asked to select a disk for the installation. Or you can use the instructions here,
How to create a bootable installer for macOS - Apple Support to make a bootable USB from the
Install Mac OS X El Capitan.app.
Before you do all that make sure you format your new disk as Mac OS Extended (Journaled) on a
GUID Partition Map.