What happens depends on who you name as your beneficiary.
If your spouse is the beneficiary, the account becomes your spouse’s HSA, and they owe tax only on withdrawals not used for qualified medical expenses.
If anyone else inherits it, it stops being an HSA on the date of death and the balance becomes taxable income to that beneficiary (or your estate). The taxable amount is reduced by any of your qualified medical expenses the beneficiary pays within one year after your death.
Because the tax treatment is so different, it is worth checking that your HSA custodian has an up-to-date beneficiary designation on file.