Replacing old doorbell transformer - wiring
The old transformer has identical wire colors for hot and neutral. The new one differentiates them.
To connect the new transformer, connect the black wire from the new one to the same black wire where your old transformer was connected with the wire nut. Connect both the green and white wires to the same spot where the black and green are connected together from your old transformer.
In your case, this is a main panel, which is why it is acceptable to connect the neutrals and grounds together (though it is not the best way to do it, but you might as well stay consistent with how your panel is wired). This question/answer should give you some more background on this.

Also note that if your new transformer looks similar to the old one, you should put the threaded part where the 120V wires come through through the knockout in the side of the panel, and use a nut to attach it there. The way the old transformer is attached is not how it should be, those wires should not be passing along the side of the panel and through an unprotected knockout like that.