I put peanuts instead of chocolate chips in the cookies I made for my friend, because he is deathly allergic to nuts.
Why would you put nuts in his cookies if they're allergic to them? Where is he now?
He's in my room, you're too late.
It's wrong to intentionally to give someone foods they're allergic to. If they consume these foods they could become incredibly ill or die. You'll be responsible for harming them because you knowingly did it and would be charged for a premediated crime.
But I'm trying to be nice and he shouldn't be greedy eating my cookies.
You can't blame him for eating your cookies when you made them to share. You should find his eppi pen or call 911 and make sure he can still breath after what you fed him.