There is a huge difference between these answers to "why did the person I fired do X?"
- I don't know, I'm not a manager, it's none of my business
- I really don't know, I told him not to actually, but he did
- I don't know, he never told me anything, and he didn't listen to suggestions either
- I'm sure he had a good reason, he never made bad choices that I saw
You have given the CEO the first one. "Not my department!" "I'm not taking sides!" "There might have been a good reason, who knows?" and this has made your CEO mad. It's probably too late to fix this, since you've done it twice, but here's what I'd try. Ask for a moment with the CEO and say
I was so shocked when X was fired, although perhaps I shouldn't have been. He did a few things I didn't understand, and I just assumed he had some information or details that I didn't have. When you came and asked me about it I was scared that I would somehow be blamed for his decisions, so I clammed up. Now I realize that I'm not responsible for what he chose to do, and I might be able to help you get the projects back where they should be if I remember some aspects of what was going on then.
At this point, you pause. The CEO may dismiss you (it doesn't matter if he says "it's too late for that now" or "I am not looking for help from someone at your level" or "the matter is under control already" or whatever, they all mean that you have had your chance to help and didn't take it.) But he may ask you something, like "why did the manager do X?" that he has asked before. If so, answer as completely and truthfully as you can. If the answer is "I don't know" don't take refuge in "and why should I after all I'm not a manager." If you have a hunch or guess, you can share it as that. If you ever discussed the matter with the manager, before or after the decision, you can share the conversation; if you never did then you can say "we never discussed that decision, before or after it was made."
What you are trying for here is openness. Not protecting yourself, not leaving an impression that you're protecting the fired manager, not trying to keep them from firing you by not co-operating. Instead it's "if there is anything I know that would be helpful I'd be happy to share it" and "if I can pitch in and make things better I will" with a little "I need to be told what constitutes better" since you apparently do.
Since I don't know what the manager did, why the manager was fired, or whether there's a connection between the firing and the things the CEO is asking about, it's hard to be more specific. You may be on the way out at this point no matter what you do. But it's possible that frank and open honesty, along with an explanation for your behaviour that is not "I think the person you fired was great and shouldn't have been fired" might enable you to find a way forward in this position. (As for how to avoid resigning, just don't resign, at least not until you have another job.)