It's mainly the way it's read. When you read the sentence, you say "Happy Birthday [short pause] John" not "Happy Birthday John."
Edit: Someone else may be able to answer that question in better "rule" terms. In non-fiction, there may be some specific rule for this, however in fiction, you have much more leeway with commas.