'Had' is the past form as well as the past participle of 'have'.
The first sentence is in the simple past tense which typically has this form: Subject + past form of verb I had (past tense of have) a bad day.
I reached (past tense form of 'reach')
the office late.
The simple past is used normally to denote an action that is completed in the past.
The second sentence is in the past perfect tense which has this form: Subject + had + past participle of verb
If two non-consecutive events happened in the past, this tense is used to show the first event.
By the time we arrived, the party had begun. =
The party began.
Then we arrived.
By the time we arrived, they had eaten all the food! =
They ate all the food; then we arrived.
I had had a bad day already, and I arrived home to find that it had been robbed! =
I was having a bad day.
During the day my home was robbed.
Then I arrived home and found out about the robbery.
Refer to Kajaco's example as well.
Here, the past perfect is used to show which incident/action happened first.
english.stackexchange.com/users/264/Manjima
Consider this sentence: I had eaten my breakfast.
This is the past perfect form with the verb eat .
This uses the past participle ( 3rd form) of the verb.
Now, just substitute the verb eat with have .
I had had my breakfast.
english.stackexchange.com/users/145/Vaibhav Garg
There's an idiomatic difference between "to have a bad day" and "to be having a bad day".
The first (mostly) refers to external events and the second (mostly) to your internal reaction to them (mood, headache, etc.)
- but there's no bright-line separation between them, just as there isn't in life.
Perhaps fully-enlightened Buddhists or Stoics can completely separate external events from their own reactions to them - but then, a fully-enlightened Buddhist or Stoic wouldn't refer to any particular day as being "bad", either.
It might be helpful to ring all the changes on this phrase and see how its meaning shifts: I have a bad day.
(Don't use this.
It doesn't work.)
Present:
I am having a bad day.
Today, bad things are happening and I am in a bad mood.
I have been having a bad day.
Much the same as "I am having a bad day", but with a hint of hope that things might be about to change.
I have had a bad day.
The effect of this one is very similar to "I am having a bad day" - bad things might or might not still be happening, but I am definitely still in a bad mood.
Past:
I had a bad day.
It's behind me; the bad part is over.
Even if I say "I had a bad day today ", the implication is that the day has ended
- I'm probably at home drinking a beer.
I was having a bad day.
I am talking about a particular time in the past (e.g., at 18:00 last Monday evening.)
At that particular moment, bad things were happening
and I was in a bad mood.
" Chuck shouldn't have crossed me - he knew I was having a bad day. "
I had been having a bad day.
Bad things had been happening; my mood was bad; things might (or might not!)
have been just about to change for the better.
" I had been having a bad day when suddenly I found a $100 bill blowing down the street. "
I had had a bad day.
On the day I am speaking of, bad things had happened (and might still have been happening at the moment I am referring to), and my mood was bad.
This particular phrase leaves some ambiguity - the bad day might still have been going on
, it might have been over
but I still had a headache, or I might already have been home unwinding with a beer.
english.stackexchange.com/users/8656/MT_Head
This evening you will tell your wife, "I crashed the car because I had a bad day."
Later this month you will explain to the insurance adjuster, "I crashed my car because I had had a bad day." Just for fun: http://www.reocities.com/oosterwal/puzzle/had.htm
english.stackexchange.com/users/3800/oosterwal
The first sentence uses the simple past of the verb "to have".
The second sentence uses the pluperfect (past perfect).
english.stackexchange.com/users/303/Steve Melnikoff
I'm not sure, but as the schoolboy put it...
"I had 'had', where I would have had 'had had',
if 'had had' had had the teacher's approval."
english.stackexchange.com/users/305/Brian Hooper
You are asking about the difference between these.
If you are asking about meanings , then the first is a simple statement of fact that stands alone.
The second implies another thought coming with it, such as I had had a bad day at work already, when I got home and discovered the basement was flooded.
english.stackexchange.com/users/720/kajaco
For example, what is the difference between the following two sentences:   I had a bad day  I had had a bad day
What does "had had" mean? How does this differ from "had"?
english.stackexchange.com
<meaning><phrases><past-perfect><repetition>
english.stackexchange.com/questions/2658
english.stackexchange.com/users/293/Casebash
The construction "had had" is the past perfect tense and is used to show the first event when two non-consecutive events happening in the past. "Had" on the other hand, is the simply past and is used to denote a completed action in the past. The second sentence is in the past perfect tense and where two non-consecutive events happened in the past, this tense is used to show the first event, as in "I had had my breakfast when…"
The construction "had had" is the past perfect tense and is used to show the first event when two non-consecutive events happening in the past. "Had" on the other hand, is the simply past and is used to denote a completed action in the past. The first sentence uses the  simple past  of the verb "to have".  'Had' is the past form as well as the past participle of 'have'.  The second sentence uses the  pluperfect  (past perfect). The first sentence is in the simple past tense which typically has this form:  Subject + past form of verb   I  had  (past tense of have) a bad day.  
The first sentence is in the simple past tense which typically has this form:  Subject + past form of verb. For example:   I  had  (past tense of have) a bad day.  The second sentence uses the  pluperfect  (past perfect). The second sentence is in the past perfect tense which has this form:  Subject + had + past participle of verb. The difference between these two sentences is that the first sentence is the simple past of the verb "to have" and the second sentence is the past perfect form.
The 'had had' results from the fact that 'had' is the past form as well as the past participle of 'have'.   The second sentence is in the past perfect tense and if two non-consecutive events happened in the past, this tense is used to show the first event, as in "I had had my breakfast when…" It's a question of simple past v pluperfect.
The first sentence uses the  simple past  of the verb "to have".  'Had' is the past form as well as the past participle of 'have'.   The second sentence uses the  pluperfect  (past perfect). The first sentence is in the simple past tense which typically has this form:  Subject + past form of verb   I  had  (past tense of have) a bad day.  
The first sentence is the simple past of the verb "to have". The second sentence is the past perfect of the verb "to have".