Panting is often an indication of intense discomfort or pain when dealing with an injury. Take him to a vet asap. I'd suggest putting kitty in a small room with easy access to litter box and food until you take him in.
puck did that once. his foot fell asleep. it was actually very disturbing for me. we fell asleep together and i must have had my arm on his one leg and had it pinned for a while. in his case it stopped within about 15 mins. if yours didn't stop it's ore likely to be broken. poor kitty. really do take it to the vet asap as the pain is intolerable with a break.
It could be caused by most anything ...... he got it stuck somehow, it accidentally got stepped on, he landed too hard from a big jump, etc. but what is worrying is that he is panting every few minutes, which can be a sign of shock. When did this happen? I would make an appointment with a vet as soon as possible for them to do an x-ray and exam. His discomfort and panting along with him dragging the leg around would warrant a trip to the vet. Let us know what happens.....