Joint pain is very common with many different possible causes. Your doctor will narrow down different potential causes depending on how or when the pain started, how many joints are affected, and if there are any other symptoms alongside.
An injury such as a ligament sprain or strain can commonly cause joint pain. More rarely, a fracture can do the same. If you can't remember any specific injury, the potential causes of your joint pain include arthritis, tendinitis (inflammation or degeneration of tendons), bursitis (inflammation of the normal sacs of fluid cushioning the joint), gout or an infection.
In the first instance, some simple first aid is the best way to start. Rest and elevate the injured joint, ice the area (be sure not to place ice directly on skin, use a towel to protect the skin) and compress the injured area with an elastic bandage. If you are suffering from pain then some painkillers and anti-inflammatories are a good next step.
If you've had a significant injury, there's significant swelling or you're in severe pain, you should seek urgent medical attention. If you have not sustained an injury but you are experiencing severe pain associated with feeling generally unwell, feverish or, again, you should also seek urgent medical attention. If you have tried simple measures and your symptoms have not started to improve within several weeks, you should arrange to see your doctor. If you have multiple joints that are painful, stiff and swollen, and any other symptoms like feeling very tired or low in energy, you should book an appointment with your doctor.
Your doctor will ask you about your symptoms, your medical history, and any relevant family medical history. They will then examine your joints, and if necessary may arrange some further tests such as blood tests to check things like your inflammatory marker levels. Your doctor may also arrange some imaging (X-ray, ultrasound) to further assess the affected joints.