Good question. I am pretty sure, you have learnt somehow, with the modal verbs you must use Präteritum for the past tense. That is not completely right. In most of the time, we use the Präteritum (simple past), but is does also exist the Perfekt-form, and here we are: Both your sentences are past tense just using the Perfekt. So the meaning is:
Ich wollte es tun.
Ich konnte es nicht tun.
The strange thing is that they use 2 infinitive forms, so that is why this is called the double infinitive: haben + Inf. +Inf.
And another thing is, they always need 'haben', never 'sein', even with verbs as gehen, fahren etc.
Gestern habe ich nach München fahren müssen.
Aber im gesprochenen Deutsch ist das Präteritum vorzuziehen:
Gestern musste ich nach München fahren.