The question is whose money went in: pre-tax money or after-tax money.
Qualified annuity: held inside a tax-qualified retirement arrangement (an employer plan or an IRA) and usually funded with pre-tax or deductible dollars. The plan must follow IRS rules, including contribution limits and nondiscrimination rules for employer plans. Because nothing was taxed going in, withdrawals are generally fully taxable as ordinary income.
Nonqualified annuity: bought with after-tax money outside a retirement plan. Contributions are not deductible, there is no IRS approval and no contribution limit, and growth is tax-deferred. Only the earnings are taxed when they come out; the after-tax premiums (the cost basis) come back tax-free.
Withdrawals before annuitization from a nonqualified deferred annuity are taxed interest first (often called LIFO): the earnings come out first and are taxable, and only after the earnings are exhausted does the tax-free principal come out. Before age 59½, the taxable part also faces a 10% additional tax unless an exception applies.
Once payments are annuitized, each payment is split by the exclusion ratio: part is a tax-free return of principal and part is taxable earnings.