Also without knowing the scene from anime, I try to analyze way of using 何が.
In such situation, B can say 「何で？」 to ask reason why A apologizes. But B chose 「何が？」. It means B is not asking about reason.
Particle が indicates 何 as subject for something or some action. Something or some action as predicate didn't told at all so that we, including A, have to imagine it.
何が悪い？ or 何がいけない？ could be one of answers but more literally, we would take A's words as it is, at first.
This example is rather idiomatic use for 「何がごめんなさい？」, because 何 is object for displaying apology therefore particle が doesn't support 何 as subject. This phenomenon can be interpreted as similar way of using は instead of を.
- そこでタバコを吸わないように。⇒ そこでタバコは吸わないように。
I would like to draw your attention to a grammar matter that structure of 何がＸＸだ is often used for rhetorical question, such as;
As a conclusion, from B's speech of 「何が？言ってみて！」,
I strongly feel that B is not asking something to A but is trying to teach how A's attitude should be about the matter they have just experienced.
So, 何が？ said by B is under intention of protest to A.
That is my opinion.