The most common setup is a junction box with wire nuts. However, in your case the original installer did a mostly good thing by installing it on the panel. The only bad part, in my opinion, is that they left the black wire as is (didn't mark it to indicate neutral, which is normally white).
Removal is easy:
- Turn off the breaker
- Remove the low-voltage wires (probably screw terminals, but can't see) from the transformer
- Loosen the screw on the breaker and remove the hot wire
- Loosen the screw on the neutral bar and remove the neutral wire
- Remove the transformer from the panel
For the new transformer, you do the above in reverse. For the wiring:
- Black to breaker
- White to neutral bar
- Green to ground bar or neutral bar. You can't always put grounds on the neutral bar, but since there are already many grounds on the neutral bar, it is presumably a true main panel where that is allowed.
Your existing transformer is grounded by contact with the panel. Your new one will most likely be grounded that way as well. The green wire is provided to make sure it is grounded in case it is installed on a plastic box. However, unless the new transformer directions say that the green wire does not need to be connected when used with a grounded metal box, you should still connect the green wire.
Note that typically you can put multiple ground wires under a single screw but not multiple neutral wires. Check the panel label. I think yours is similar to mine (definitely same brand based on breaker handle color), in which case you can put up to 3 small grounds on one screw. But the label is the rule, not some random person on the internet.
There is a second option, but really if you 100% just can't get the neutral bar screw undone:
- Turn off the breaker
- Remove the low-voltage wires (probably screw terminals, but can't see) from the transformer
- Loosen the screw on the breaker and remove the hot wire
- Cut the neutral wire as close as possible to the transformer
- Strip the transformer end of the wire to an appropriate length for use with a wire nut
- Wrap white electrical tape over the entire black portion of the wire (i.e., everything except the part you stripped).
- Remove the transformer from the panel
Then when you install the new transformer:
- Black to breaker
- White to old neutral wire with an appropriately sized wire nut
- Green to ground bar or neutral bar. You can't always put grounds on the neutral bar, but since there are already many grounds on the neutral bar, it is presumably a true main panel where that is allowed.
However, I would be concerned about the condition of the neutral bar for both current use (if the corrosion affects the connections) and future use (if one screw won't come out, you will probably have problems with other screws on the bar).