Why did my transformer explode? Was it faulty?
You connected it backwards. Primary color code Black/Yellow/Red.

In the future, you should read the datasheet and catalog and not make assumptions and also you can double-check by measuring the resistance. The primary for 115/230VAC will have much higher resistance than the secondary.
Also a small fuse in series with the primary would have saved it.
Note: On the primary, leave the unused connection open. If you connect the black and red together to one side of the line and yellow to the other and apply 120VAC you'll burn out the transformer (and the fuse might not even save it!).