Are you Mr. X?
If I want to ask if someone is named X in a formal situation (for instance Are you Mr. Kowalski?), can I ask: Czy nazywa pan się X? And also is the name in vocative or nominative?
Interesting question. And frankly, I'm not sure what to say here. I imagine myself just asking "Pan Kowalski?" if I think it's most probably him, but otherwise... yeah, I guess "Czy nazywa się pan Kowalski" (I prefer such a word order, but your is correct, I guess).
Frankly, nothing seems totally natural to me here...
Yes, you should say in a formal situation: "Czy nazywa się pan Kowalski?" or "Czy ma pan na nazwisko Kowalski?".
Formal phone call: „Czy mam przyjemność mówić z Panem Kowalskim?”
Face to face situation: Przepraszam, Czy Pan Kowalski? or Przepraszam, Pan Kowalski?
If you want to use the verb "nazywać się", nominative should follow. On the other hand, with "być" you should use instrumental, never vocative. Cases with names are often avoided though (thus the preferred simplified constructions: "[Czy to] Pan Kowalski?") because some names sound weird when not in their original form and there's a danger of distorting them. By the way another very formal and polite form of asking for someone's name is: "Pańska godność?" but we wouldn't rather use it when making sure if X is the person we're talking to.