You have to request a refund. It is not automatic. If you subscribe to it you have to pay for it whether or not you use it. Make sure it is canceled fully and did not automatically re-subscribe, then ask for a refund (those are not guaranteed).
This support article explains how to cancel a subscription from Apple on various kinds of hardware and online ➔ Cancel a subscription from Apple - Apple Support Use the drag-down menu to choose the kind of equipment you have.
Notes:
• “If you signed up for a trial subscription and you don't want to renew it, cancel it at least 24 hours before the trial ends.” Exceptions in: About canceling subscriptions in Germany, Israel, South Africa, or Türkiye - Apple Support
• Free trials will usually automatically turn into paid subscriptions unless you cancel in time.
• Many subscriptions are set to renew automatically until you intentionally cancel them.
• If you don’t see Cancel Subscription, then the subscription is already canceled and won't renew. An "Expires" date (instead of "Renews") means the current subscription has been canceled but will work until the expiration date. "Resubscribe" (or Renew) is just in case you change your mind about having it end.
• Deleting an app does not cancel a subscription.
To request a refund for apps or content that you bought from Apple click on this link --> Request a refund for apps or content that you bought from Apple - Apple Support