Yosemite is so old that it is possible that it cannot access the App Store any more.
If your Mac is compatible with Catalina, what you could try is doing the upgrade in two steps:
- First, upgrade from Yosemite to Sierra. The Sierra installer is available as a .DMG file. If necessary, you can use a modern Mac or PC to download this file and put it onto a USB drive for transfer to your Mac. This does not create a bootable installer – it is just a workaround in case the browsers on Yosemite can't handle the security needed to access Apple's Support page. You will need to open (mount) the .DMG file under Yosemite to get to the installer application (or to a "package" containing the installer application).
- Then upgrade from Sierra to Catalina. Sierra's versions of Safari and the App Store are newer than Yosemite's … and may have more luck accessing the Catalina App Store link.
If you can upgrade to Sierra, you might want to make a bootable clone backup of it before proceeding to upgrade to Catalina, just so that you'll have that much progress saved in case something goes wrong.
macOS Catalina is compatible with these computers - Apple Support
How to download and install macOS - Apple Support