GAP (Guaranteed Asset Protection) covers the difference between your insurance payout and your loan balance if the car is totaled or stolen. Insurance pays what the car was worth; GAP pays what you still owed beyond that. If you would owe more than the car is worth at any point in your loan, GAP is protecting real money.
Say you finance $38,000 on a new SUV with taxes and fees rolled in. Two years later it is totaled, and your insurer values it at $26,500 while your payoff is $30,800. Without GAP, you write a $4,300 check for a car you no longer have. With GAP, the contract covers that difference (most plans also have limits and exclude your collision deductible or cover only part of it; read yours).
The gap is biggest early in the loan, when depreciation has outrun your principal payments, and it grows with anything that raises your starting loan-to-value: small down payments, long terms, financed taxes and products, or negative equity rolled in from a previous car.
It is required on many leases (often built in) and occasionally by a lender on high-LTV loans, but on a typical purchase it is optional.
As a one-time dealer product it is commonly a few hundred dollars financed into the loan; through some auto insurers it is a small add-on to your premium. Prices and terms vary, so compare.
Generally yes, with the unused portion refunded pro-rated, typically applied to your loan balance. If you refinance or pay off early, cancel it: the coverage no longer serves a purpose.