The verb 'had' is used in the perfect tense as in:
He had done the work.
We had not looked at it.
The verb 'had' is also used as a normal verb in place of 'eat',etc.:
I had some bananas yesterday.
We had a dazzling experience last night.
When these two verbs combine they form had had:
I had had some food