If you say, "I wish I had X", then it is a wish about the present situation. The use of the past tense is a subjunctive verb form here (notice there is no time indication given for this verb).
"I wish I had had X" is a wish about a past situation. This double had is - as other members have pointed out - a past perfect form. The first "had" is the auxiliary verb. The second "had" never changes, as it is a past participle. If you change it to present perfect, you'll see "have had".