You are assuming the TSA were the people who opened the lock. Was there a TSA inspection notice in the bag?
It could be the lock broke and fell off, it could be airline or baggage people who broke in shopping, it could be the TSA needed to do an inspection and their keys did not work (you mentioned the lock was not functioning properly), or it could have been as simple as so many people can't figure out how to change the combination, or don't want to be bothered, that somebody just put in 0000 and popped it for a look inside the bag.
I am always amazed when you get a bag back and the combination is set differently than when you dropped it off. Somebody tried to get in.
The point of locking is to hope that the casual thief, if given a choice between two bags, will choose the one without the lock instead of having to spend time on the one with a lock. It's certainly not going to keep anybody who wants into your bag from getting there, just a deterrent to get them to consider another bag.
But leaving the combination at 0000 or whatever made it too easy for them.