- My name is John.
- The name is John.
Which of the above sentences is grammatically correct? If both are, which is preferable and why?
Both of them are correct, but they are not equally suited in every situation. "The name is John" can be used if two people are conversing, and one person is stuck in making a statement because it requires the other person's name which he or she doesn't know.
A: Okay, so I'm reserving a room for two people in the name of Mr. ...
B: The name is Harris. Bob Harris.
It can also be used to give a correction:
A: So, Mr. Harolds, how do you like the room?
B: It's great, and the name is Harris by the way.
A: Ah, I'm sorry. Right, Mr. Harris.
This is a fairly abrupt way to correct someone, which we would use on someone in an inferior social position. It communicates the idea "you should have remembered my name" (perhaps because it's your job, or I am more important than you, and so on).
Suppose the speaker is a lowly clerk in the proverbial mail room of a big company, and the CEO happens to speak to him, and does not get the name right. It would be quite inappropriate for the speaker to respond with "the name is Harris", being seen as a challenge to the authority of the CEO and the relative rank between the two.
In the above conversation, Harris greatly softens the rebuke by first answering the question and complimenting the hotel room, and then adding "by the way" as if to say "this is just a small, unimportant side note that I'm adding".
Outside of this type of context, if it just used "out of the blue", an introduction like "the name is Harris" roughly means something like, "there is naturally an expectation in the air that you (or everyone present whose attention is riveted on me) want to know who I am, and so I'm dropping it on you: the name you anxiously want to know is Harris."
Nitin Varp aptly remarks in the comment, "it sounds good in movies". The reason is that it's used by confident male characters, and the remark in Arun Raj's answer is also basically correct: it is not good manners, because it conveys the presumption that the other people are eager to know the speaker's name.
In the first A/B example the situation is different because A shows signs of requiring the name, and B essentially completes the sentence that A started. Moreover, A never asked the question "what is your name?". In that particular conversation, it is even possible that the person making the reservation isn't actually Bob Harris.