Some credit cards that are unused are closed automatically or closed by the card issuer if they see no activity for a period of 2 years or longer.
I've had one credit card through Capital One that got closed automatically after 2 years of inactivity and I called Capital One and they said that after 2 years of inactivity the credit card would be closed automatically.
Having your credit card closed automatically by the credit card company could hurt your credit so it's best to use the credit card at least some and pay the balance off to help boost your credit score.
Credit cards can be hard to get today so if you have an open credit card use it for even small purchases and then pay the bill on time.
Doing so will keep your credit score in good shape and then you can qualify for other loans etc.
Once you lower your credit score it can be hard to get your credit score back up.