Blowing up a doorbell transformer
Since both old and new have problems, it is probably not a &quot;bad&quot; transformer, but rather something else that lead to the transformers failing.
Two things to check:

Mains voltage - Should be 120V (anywhere 110V to 125V is perfectly fine). If it is in the 200V - 240V range then you have this wired up to a 240V circuit instead of 120V and everything double and transformers release the magic smoke.
Short circuit - A short would cause a real problem. Check continuity on the doorbell switch to make sure it is not welded closed; check the chime (may get a bit trickier) to make sure it is not acting as a short (or near-short) circuit. A few hundred watts would be enough to fry the transformer but would not trip a 15A circuit. Keep in mind that while an electronic chime will keep ringing if the circuit is closed (until something burns up), an old style bell will give one ding (or dong) for each press of the doorbell switch. If the switch stays closed, you get one ding and then nothing...until something overheats.

Keep in mind that power (Watts) = Volts x Amps. Volts is easy - check (edits and comments indicate you did that) that the voltage is ~ 120V. In a typical residential situation, voltage will be pretty constant if the system as a whole (utility feed, breaker panel, etc.) is installed and functioning correctly. So that leaves current = Amps. That will depend on what is connected on the circuit. In the case of a transformer, the load on the secondary determines the amount of current flowing through the primary. (Don't ask me how that works - it still kind of baffles me - &quot;physics&quot;). So if you have a short on the secondary, the primary will try to provide as much power as it can, up to the value determined by Ohm's law - nothing is a 100% short circuit. On a DC measurement, each coil should show continuity (i.e., very low resistance). The rest of the circuit (in this case, on the secondary) is the key - if, for example, you replace the chime with a piece of wire then you cause a short circuit every time you press the doorbell. If you replace the chime with a 1 Ohm resistor, then Ohm's law says that at 24 Volts you will have 24 Amps = 576 Watts, far more than the 40 Watt (technically VA, doesn't matter Watts vs. VA for this right now). On the other hand, that 576 Watts divided by 120 Volts (nominal) is less than 5 Amps, so no breaker is tripped - but the transformer is fried.