It could be due to many things, such as arthritis, injury, infection, gout, over-use of the joint in exercise which causes something called tendinitis. There are things you can do to ease the pain, but get medical help if it's very painful, it does not get better or keeps coming back. 

 

Things you can try at home are ease the joint by resting it, you can put an ice pack on it (or frozen peas) wrapped in a towel, or take a pain killer such as ibuprofen. If you are overweight, losing weight may also help you.