The facts; he was ill, you chose to do a kind thing and buy him some medicine. It was late, he was (obviously) tired, maybe even exhausted from coughing. He has ASD.
You got scared, and it took, 5 minutes? 10 minutes? Until you were let in. You were upset and a little recriminatory when you were let in.
Were you grateful for being let in, yourself? Were you staying there or do you have your own place?
In any case, your choices; you chose to go late, did you consider that a sick man might badly need sleep?
Did he not appreciate the medicine? Did he not say thank you for the medicine? Or did you not give him a chance to express appreciation for the kindness you showed him, before you shamed him for not being awake for you?
Aspies don't like "drama", in that shaming, blaming and recriminations, especially, when we are tired and ill, will not get the desired response. We prefer calm explanations, said with clarity and without loaded recriminations or emotionally manipulative behaviour.
If you had humbly said "man, that was scary! I didn't know when you we're going to let me in!" or some such honest expression of your experience, I imagine, he wouldn't have felt attacked and shut you down, he would have felt concerned and neglectful and showed more concern and you would have got your remorseful response. That your fear quickly turned to anger, would have frightened him, overwhelmed him, shamed him, embarrassed him and as such, he, lacking the skills or emotional maturity and social graces of , I don't know? Someone you imagine would respond differently ... not an Aspie, realistically. He wanted a quick and face saving, out, and quickly tried to change the subject.
You could have let it go, decided compassion and forgiveness would bring you more happiness and realised that a sick guy could've been forgiven for falling asleep, late, at night.
But you are both human, humans don't act in prescriptive ways, they act in emotional ways, reactive ways, self interested ways, clumsy, clunky, human ways.