If an account isn't in use anymore but you still want its history around — say, a bank account you closed in real life — deactivate it instead of deleting it. Deactivating tucks it out of your everyday lists (unless you turn on "Show Inactive") while keeping every past transaction intact and countable in your reports.
Deleting is more final and only works when an account has no transactions on it and isn't your default or used in any budget — otherwise the app will simply explain that it can't be done rather than let you attempt it. When in doubt, deactivate; you can always reactivate an account later, but a deletion can't be undone.