If you haven't previously downloaded it, Apple no longer gives you the option to download it, as a newer version is available. You can download the newest version, macOS Sierra, from the App Store.
If you only want to go to Yosemite, and not the newest version, you'll either need a friend or someone whose previously downloaded it from the App Store, and download it from their account (either directly onto your system or onto a USB drive to install from), or you'll need to buy/obtain a USB installer (they can be found on Amazing). All versions of OS X have been free since Mountain Lion on The App Store.
If you need instructions on how to get and install it from the App Store, let me know, and I'll supply you with step-by-step instructions with photos, but it should be rather easy 🙂