That is the past perfect of "to have". The past perfect of a main verb is formed from these two elements:
1. The simple past form of "to have", which is "had".
2. The past participle of the main verb.
Now, it just so happens that "to have" can act either as an auxiliary (or helping) verb, but it can also act as a main verb. And, it also just happens that the past participle of "to have" is "had" -- exactly the same as the simple past form.
So, the first "had" is the simple past of "to have", while the second "had" is the past participle of "to have".
- For Teachers