Credit cards offer a grace period from the time of purchase until a fixed due date. During that grace period no interest is charged.
If you pay the FULL AMOUNT owed by that due date, then you will pay no interest. If you pay only the minimum required payment (or any amount over the minimum but less than the total owed), then you will owe interest.
Example. Bob and Dave both get new credit cards, both go to the store and both make a $300 purchase on April 1st. Their statement period ends on April 30th and they receive a bill showing that they have a balance of $300 with minimum of $25 due by May 20th.
Bob pays the full $300 before the due date, and then has a $0 balance. If he doesn't use the card again his balance the next month would be $0
Dave pays $50 before the due date. His balance is now $250 and interest will begin rolling on his account. If he makes no additional purchases he'll get another statement at the end of May showing that he owes about $260 (balance went up because of interest).
Both Bob and Dave have paid on time, and will get a positive report on their credit reports for their payments. However Dave will pay interest because he borrowed money and didn't pay it back right away. Whereas Bob would pay no interest.
Credit cards are called revolving accounts. You could theoretically carry a balance forever if you keep making payments but keep spending more. The debt just keeps rolling over.
Mortgages, car loans, etc are fixed term loans. The bank loans a fixed amount of money, then a payment schedule is agreed to where you repay monthly. Each month your payment has 2 parts: interest and principle. Interest pays off interest that accrued that month, the principle portion pays down the loan balance.
These loans generally have no grace period, interest begins the day you borrow the money and you typically don't get more money later because the total amount of money loaned to you is already set and doesn't change. Your balance owed on the first day is the amount borrowed and each time you make a payment your balance owed goes down until it reaches $0 and the account is closed.