Guinea pigs also have a tendency to freeze when they're frightened, so maybe the pig was just freezing when you were handling him, and when he realized it wasn't going to get him back into the cage he bit.
I learned that if you get bit you should never put it back in the cage right away, because it teaches them that if they want to go back they should bite you. Wait a couple minutes after he bites you to put him back in.
Try giving him treats when you handle, and just get him used to you. Eventually he'll come around.