Your iMac from 2011 can only upgrade as far as macOS High Sierra.
What happened when you tried clicked on the links.
Open your Safari browser do not use Firefox.
How to upgrade to macOS Sierra - Apple Support
How to upgrade to macOS High Sierra - Apple Support
In each case go to Section 4 and click on Get macOS Sierra or Get macOS High Sierra.
If you download Sierra you will get the InstallOS.dmg in your Downloads folder.
Open that to get the InstallOS.pkg which you open to get an installation window,
this does not install Sierra but creates theInstall macOS Sierra.app in your Applications folder.
If you choose High Sierra you will be redirected to the App Store from here you
download Install macOS High Sierra.app directly to your Applications folder.
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'.