One is not better than the other
Car loan and a credit card (both secured and unsecured) are two different types of credit, and both build your credit and improve your score.
Car loans are actually installment credit. Installment credit is a credit given against some kind of guaranty (your car in this case). You need to pay on an installment loan for at least 12 months for it to do much to your score. Of course that with such loan you pay interest, so taking an installment loan strictly to build credit is an expensive way to buy a few score points. Taking an installment loan for something you actually need, like a car, makes better sense.
Credit cards are revolving credit. It means that you can carry (or revolve) your balance from one month to another. Revolving credit is considered to be the riskiest, because unlike installment credit it is not secured.
Credit card’s interest rate is usually murderous, but because credit cards have interest free grace period between the purchase date and the statement due date – you can avoid interest payment by paying your statements in full each month.
As to your question which is better – One is not better than the other. In fact, to get a good credit score you need a mix of installment and revolving credit.