It's most likely teething pains. Puppies generally teeth from three to seven months. At this point, the adult molars are probably coming in.
Give it a nice solid chew toy, remove anything else it tries to bite or chew on from its mouth and discipline it gently but firmly so it learns what it is and is not allowed to bite.
If it is biting you, at that age, it's play biting - and it needs to learn that play biting humans is not acceptable at all. You may want to think about taking it to puppy obedience classes if you are having problems controlling this behavior.