The dog might have arthritis which is a common condition in an older dog. Another condition with these symptoms can be a tumor. The dog may have injured itself. It's probably a good idea to have the dog checked by a vet.
A lump in a dog's leg could be a possible tumor. If there is pain, it could be swelling from a broken bone. It could also be an infection from a cut or injury. The dog should be taken to the vet right away.
A wide variety of things could be wrong. The most likely outcome for pain and a lump in your dog's leg is a tumor. You must take your dog to a vet. I know it's expensive, but this could be life threatening.
It could be a number of things your dog may have gotten hit by something or something may have bitten it if you are worried you should call the vet tell them what you see and how the dog acts and they will be able to tell you.