That is the correct adapter. The box shows "Thunderbolt Display" in green, with a check mark to show it is compatible.
Do the plugs on your display match those in your first picture? (Just two plugs: power and Thunderbolt) The power plug won't be used with the iMac. The similar non-Thunderbolt display would also have USB and FireWire plugs.
It could be a defective adapter. Are the plugs pushed in all the way? (No metal showing)
Try turning over the USB-C plug on the adapter that goes into the computer. It should work either way, but there was one report of it working only one way. That would mean a defective port or adapter. Did you try both Thunderbolt-3 ports on the computer.
It could also be a problem with the iMac. Do you have any other Thunderbolt-3 devices to try.
If the Display works with your old computer (and it is really the Thunderbolt model), then either the iMac or the adapter is bad.