In general, debt used to purchase income generating assets is good debt. Debt used to purchase consumable items, or depreciating assets is bad debt. For example, debt used to buy an investment rental property that generates a positive cash flow is good debt. Debt used to buy a car, pay for groceries, or a vacation is bad debt.
Debt used to pay for education leading to a better paying job, career advancement and a greater income is considered good debt. Student loans for a degree in a field with no job opportunity or a very low paying job is probably bad debt. What kind of job will pay a philosophy major enough to live on and also pay off the student loans? The debt incurred to obtain a PhD is probably bad debt if you end up being a cab driver.
The debt used to purchase a primary residence is bad debt but necessary. A primary residence does not generate any income, but the debt service is a liability until the property is paid off. Now you may argue that the primary residence appreciates and you realize a profit (income) when you sell. In principle, I agree, but appreciation is not guaranteed and usually slow when it happens. If you hold the property long enough, you should realize some appreciation but consider that you are paying interest on your loan while the property is appreciating. If you hold the property long enough you might break even. For example, if the house you paid $100K for 30 years ago is now worth $250K you see this as a potential $150K profit when you sell. However, consider that you paid a total of $250K in principal and interest for 30 years to retire your loan, You just break even at best. There are a few real estate markets where this is not the case, but for most real estate markets, home ownership iis more expensive than renting -- especially if you sell and move in every few years.