"I have an epi-pen. It's very important to me because my friend gave it to me as he laid dying."
The punchline of this joke is that the teller of the joke is too ignorant to understand the point of an epi-pen. However, the joke itself is a paradox because the teller had stated that they have an epi-pen, which suggest that they are aware of their existence and would also know what purpose they should serve. For those who are not aware, an epi-pen is a colloquial term used to a device called the Epinephrine autoinjector. It is a medical device used to inject a measured dosage or dosages of epinephrine (adrenaline) by means of autoinjector technology - they are commonly spring-loaded syringes, but the main point of autoinjectors are that they can be used with ease by patients on themselves or untrained individuals in the position of using it on the patient.
The Epinephrine autoinjector, being that they resemble pens, are called EpiPens. They are commonly used to treat anaphylaxis, a type of serious allergic reaction which Is rapid in onset and cause many symptoms including but not limited to rashes, throat swelling, lycanthropy, angioedema, and low blood-pressure. They can also ultimately result in a lethal condition called death, which cause the sufferer to die, thus individuals who are in the position of suffering from anaphylaxis need to have EpiPens around in the case they suffer a serious allergic reaction.
Returning to the topic of the joke, the teller stated that their friend gave the EpiPen to the teller as they laid dying, which suggest that the individual is a person who can suffer from anaphylaxis. While this does not necessarily state that they are dying from anaphylaxis, and perhaps they are simply handing the EpiPen to the teller because they are dying from illness on their deathbed or bleeding out and had chosen the EpiPen as a memorabilia of their friendship, the fact that this is a joke suggest that the teller intend to inform the audience that their friend was dying from a serious allergic reaction. The joke left it open-ended whether or not their friend expired, thus perhaps the teller had used the EpiPen successfully and is simply keeping it as a reminder of their heroism.
However, it would have been more horrifying and comical if it is assumed the teller watched their friend die, being too ignorant to understand that their friend had handed them the EpiPen to be applied to them in order to treat their anaphylaxis.