Have you previously purchased GarageBand and is it in list of your recent purchases, when you sign into the AppStore with your Apple ID? Then you can follow the advice of Alma and reinstall from the Recent Purchases. But you will have to use your AppleID at the AppStore.
If GarageBand is not in your recent purchases, it will be more involved.
The App Store is only offering the applications for the most recent system versions. You have to get the applications for each system version, while the system on your Mac is the current version.
Apple is encouraging us this way to keep our system versions current.
To download GarageBand for the first time now, you have to purchase it (for free) on a Mac with macOS 11 Big Sur or later to associate it with your AppleID. I think your iMac is not compatible with Big Sur (macOS Big Sur is compatible with these computers - Apple Support)
Do you have a newer Mac with macOS Big Sur or later installed or can you get access to one? Then purchase GarageBand there with your AppleID and then try to download GarageBand again on your iMac.