In the last paragraph of the essay, the narrator states very clearly why he felt compelled to kill the elephant and in doing so exposes the heart of imperialism:
"Afterwards, of course, there were endless discussions about the shooting of the elephant. The owner was furious, but he was only an Indian and could do nothing. Besides, legally I had done the right thing, for a mad elephant has to be killed, like a mad dog, if its owner fails to control it. Among the Europeans opinion was divided. The older men said I was right, the younger men said it was a damn shame to shoot an elephant for killing a coolie, because an elephant was worth more than any damn Coringhee coolie. And afterwards I was very glad that the coolie had been killed; it put me legally in the right and it gave me a sufficient pretext for shooting the elephant. I often wondered whether any of the others grasped that I had done it solely to avoid looking a fool."
The essay is provided on various internet sites, and below I provide one.