A transaction is used in database processing where you want to make non-trivial changes. For example, in banking, when you want to make a transfer from one account to another you could do the following
1) deduct the given amount from the first account
2) add the given amount to the second account
Obviously, if step 2 fails you want to put the funds back into the first account. You can easily add appropriate error checking into your code to handle this. As the required changes become more complex (if you have more steps), the code becomes increasingly complex as you program in multiple "undo" scenarios. Instead of handling this in code you can use a transaction. Simply put you do something similar to
do step 1
do step 2
do step n
If any of the steps fails then the transaction is canceled. You don't have to worry about undoing all of the steps preceding the error. A transactional file system would be similar except on a file rather than a database level.