If you are talking to a person other than Juan, you do not use commas to separate the person's name.
¿Juan cuando compró su coche?
¿Cuándo Juan compró su coche?
¿Cuándo compró su coche Juan?
They all mean "when did Juan buy his car?
If you are talking to Juan...
¿Juan, cuándo compró (usted) su coche?
¿Cuándo, Juan, compró (usted) su coche?
¿Cuándo compró usted su coche, Juan?
(The use of "usted" is optional in any of the sentences, but it would normally be used if there are more than one person in front of you and you want to make it clear that you are asking the question to Juan, no other person).
All these questions mean "Juan, when did you buy your car?"
I hope this helps.