JOEL - Because that's the way the lockers are made nowadays by the company that sells them to the church. They don't make them without locks. Also, having that locker key with the number on it, helps you find the locker you used when the temple session is over.
I believe years ago, before the locks, occaisionally a few things had been taken by a few Mormons who were not honest. And there where also some dishonest nonmembers who somehow obtained temple recommends, which provided themselves easy access to valuables of unsuspecting temple patrons.