I don't go to gyms, but if I did, there's no way I would leave anything of value in a locker. I've seen too many news reports, and heard too many stories from people about stuff getting stolen from lockers.
Even when people bring their own locks, I've seen some techniques thieves use to easily "pop" open lockers even when there is a lock on it. There's more than one way to open a locker. People might be surprised just how easy it can be.
In a gym, I would keep my valuables nearby at all times in a gym bag (along with water, towels, cell phone, etc). I'd use a duffle bag big enough to be highly visible and not easy for someone to just pick up and walk away with it without being noticed (like some little fanny pack).
As far as the question of "why would anyone feel the need to carry a knife there?", which is a question that seems to come up every now and then, my answer is - I don't just carry a knife for the times when I know I will need it, I also carry a knife for the unexpected times when I don't know I will need it (and I don't mean for use as a weapon). I can't count how many times I've found myself needing a knife at a time, or in a place where I never expected to.