If they deserve it then sure.
Not at all, if the punishment was for turning up late and giving a bit of back chat then entirely deserved, but why not state that as the reason? According to the OP: "it was for taking his PE bag to the classroom and nothing else".
People in this thread are acting like all teachers are shining pinnacles of all that is right within the world and could never set a foot wrong.
I've worked and taught in a college and seen what goes on behind the scenes, and trust me, whilst there are plenty of good ones, there are also those who enjoy a power trip, and think that because they're in front of a room full of children they can get away with the kind of behaviour that would see them in front of an employment tribunal or disciplinary hearing in the real world.
From what's been posted in this thread (which of course is probably not the whole truth), the kid did nothing wrong* - I find it hard to believe that there's a clearly published rule stating that PE kit shouldn't be taken into classrooms.
So again - what is the purpose of the punishment? Is it to make sure he doesn't break the rules again? In which case which rule has he broken - is it a rule that the science teacher has made up on the spot?
* Barring losing his locker key, for which he's already been "punished" by having to pay for a new one, and should have no bearing on how he is treated by his science teacher.