Why couldn't I <have killed vs. kill> that dragon when I found him in the woods?
Here's the first paragraph of the plot of the movie 'How to Train Your Dragon' in Wikipedia:
The Viking village of Berk, located on a remote island, is attacked frequently by dragons, which take livestock and damage property. Hiccup, the awkward fifteen-year-old son of the village chieftain, Stoick the Vast, is deemed too scrawny and weak to fight the dragons, so he instead creates mechanical devices under his apprenticeship with Gobber, the village blacksmith, though Hiccup's inventions often backfire. During one attack, Hiccup uses a bolas launcher to shoot down a Night Fury, a dangerous and rare dragon of which little is known, but no one believes him, so he searches for the fallen dragon on his own. He finds the dragon in the forest, tangled in his net, but cannot bring himself to kill it, and instead sets it free.
The emboldened last sentence corresponds to a first YouTube video, which I suggest you watch in order to fully understand the context.
Now, later in the movie, there's this scene (the whole script is here):
Astrid: It's a mess. You must feel horrible. You've lost everything; your father, your tribe, your best friend...
Hiccup: Thank you for summing that up. [sadly] Why couldn't I have killed that dragon when I found him in the woods? Would've been better, for everyone.
In the emboldened sentence, Hiccup is referring to his earlier action described in the last sentence of the above plot and the first YouTube video.
And this later conversation is shown in this second YouTube video, which I think you must watch to answer this question.
Question
Why did Hiccup say have killed instead of kill in the second YouTube video?
Would there be any difference in meaning if he used kill instead?
Why couldn't I kill that dragon when I found him in the woods?
The kill version indicates that he tried but failed.
Q: Why couldn’t I pull the sword from the stone?
A: Because you aren’t King Arthur.
The have killed version indicates thinking about a choice different from what actually happened. It strongly suggests that the speaker thought they could have successfully taken the contemplated choice, and regrets that they didn’t.
Q: Why couldn’t I have studied harder for the exam?
Response: Now you know what to do next time.