TNT Duping works by using piston pushing behavior to make the TNT both light and move at once, creating a moving TNT block and a TNT entity. The order this follows is: The piston, in the same tick it powers but before moving, creates a list of the blocks in front of it that need to be moved. The TNT gets ignited. In order to do this, the update that powers it needs to come from
A few of them can be reused because they are movable
These specific blocks are able to create a normal update after the list of blocks to be moved is created, but before some of the moved blocks have been removed. That needs to happen before the TNT block is removed: before a block behind the tnt replaces it. if there is no blocks, it can be after the moving TNT was created. This update can also be propagated through other blocks, as long as it is instant (for example using rails, dust, noteblocks (1.13+), or TNT itself), which allows for up to 11 TNT to be duplicated using a single piston push, the 12th block being for updating. The tnt moving block is created from the moved block list regardless of the original tnt being ignited or not, and this means that the TNT is preserved in block form.
Mojang historically opposes TNT Duping as they consider it an exploit, and they have tried to patch it four times, but in the 1.16 snapshots they declared they will leave it in the game for the time being, due to a lack of replacement for what TNT duping currently allows: https://www.reddit.com/r/Minecraft/comments/fkt9jf/anchor_yourself_to_the_nether_snapshot_20w12a_is/fkv33q3 https://www.reddit.com/r/Minecraft/comments/e5gx0s/comment/f9q2eih/
TNT Duplication, or TNT Duping, was first discovered in 1.9 by myren eario but was not used as it was impractical before the addition of slime blocks. It was also not well known. Methods have then been discovered for all versions except 1.0 to 1.2 and 1.8. It gained popularity with the invention of world eaters.