If he's 2 years and 3 months, he's a little old man

So he may well have arthritis. But he could have dislocated something as well. It would be best to get him checked by a vet, who can also prescribe pain relief medication, which can really help their ageing aches and pains - and also check out the leg.
A tip if taking a robo to the vet. I used to take mine in a guinea pig sized pet carrier, half full of bedding, with a "snooze cube" inside (it's like a fleece hide for out of cage time). And I'd take a Rub bin with me - it was about 20cm high, 50 cm long and 35 cm wide. I'd have some hemp mat in the bottom of the bin (fleece or a towel would do as it's only for a short time). And take a tunnel, a hide and some food and sometimes even the wheel!
Then when at the vets, I would put the bin on the vet table, with the tunnel, wheel, hide and some food in, and lift the snooze cube out of the pet carrier (with the hamster inside it). And just put the snooze cube down in the bin. It's a gentle easy transfer for the hamster without a hand grabbing them from inside the pet carrier. And also it keeps them safe so they don't run off the vet table!
The other thing is, it lets the vet see him walking around in the bin to get a good idea of what the problem is with the leg. and when the vet picks him up to check him over, she can hold him over the bin and it's easy to put him back in there. The wheel, tunnel and food are just to distract the hamster from a clinical experience, so he can have a bit of a play while the vet is talking to you