Your HSA is an inheritable account. What happens to your HSA when you die depends who you named as your beneficiary.
Spouse designated beneficiary. If your spouse is your designated beneficiary, the account will be treated as your spouse's HSA after your death. The account will continue to be tax-free for qualified medical distributions. If your spouse is covered by a qualified HDHP, contributions to the account may also be made tax-free, up to maximum annual contribution limits.
Other than Spouse designated beneficiary. If you designate someone other than your spouse as the beneficiary of your HSA:
The account stops being an HSA on the date of your death;
The fair market value of the HSA becomes taxable to the beneficiary in the year in which you die (without penalties); and the amount taxable to a beneficiary (other than your estate) is reduced by any qualified medical expenses you incurred prior to your death that are paid from the HSA by the beneficiary within one year after the date of death.
Your estate is the beneficiary. If your estate is the beneficiary of your HSA, the value of your account is included on your final income tax return. No designated beneficiary on file. If you do not have a beneficiary on file, the funds are payable to the accountholders estate.