There are a lot of causes, some can be as a result of hard brushing which causes injury to the gum and may lead to pains., In a situation like this it is the best for us to brush the mouth in gently to prevent further damage. Some can also be as a result of gum disease which attack the root of the gum, it is always a bacterial infection and sometimes in serious cases it might lead to swelling of the teeth which can be extremely painful... The best is just to discuss with a dentist to determine if it is something serious or not.