Aki(or the gun devil) was wrecking the neighbourhood and was dead set on killing Denji so Denji had to kill him before things got messy, I assume. Plus the people around him were cheering him on and asking him to protect them from the gun devil(if I remember that part correctly) so I think he felt that he had no choice at the time BUT to kill Aki. This is why later on he says that he should've tried to find some way to defeat the gun devil without killing Aki, because he felt like he had no choice at the time even though there could've been some other option. He also didn't mean to 'kill' Power, he was just confused by Makima's instructions. Remember that unlike us who'd seen Makima's scary side, he viewed Makima as his saviour who'd saved him from his shitty life, and he thought the best of her and was in even in love with her. Imagine if the person you trust the most in this world and the person you've trusted yourself to(in the scene before he says he wants to be her dog and just leave her to do everything for him), suddenly says they want you to open a door so she can kill your sister figure. Like him, I'd be confused as hell and think it was some sort of joke(you can tell he's in disbelief because of his expression). He probably followed her instructions because he trusted her so much and didn't fully comprehend her intentions.
wait so what uh the why did she make him kill Aki and Power and wtf was the place with the doors at the top and their limbs were chopped