Non-medical withdrawals are taxed as income, plus a 20% penalty if you are under 65.
After 65 (or if you are disabled) the penalty goes away, and you pay only income tax. At that point, an HSA works much like a traditional retirement account for non-medical spending, while medical withdrawals stay tax-free.
If you take money out by mistake for an expense that does not qualify, contact your HSA custodian. Many custodians allow you to return a mistaken distribution.