Your guinea pig is probably scared. I would talk softy to it everything you try to pet it in the cage. Let him get use to you and build trust. Then ease him into holding him in your hand in the cage. More trust. Eventually I think he will trust you to hold him.
How do I pick up a guinea pig that won't let me pick it up? My guinea pig is just too adorable to leave in the cage without cuddling!
Give it food, and of you're around enough, they will come out of hiding. Or you could do what I did, and chase it out of the cage (but that's not advisable, as it might make them even more scared of you; I was 9 when I got my piggies, so I didn't really know any bette, and they are kind of scared of me now).
Small rodent pets are notorious for being difficult to handle. This is most often attributed to how they've been handled in their past. They are often very mishandled and have learned to mistrust handlers..they don't yet know that you don't want to hurt them. Sooo ,., with a tremendous amount of patience and tenderness take the time to gain its trust. Spend time .. Hand feed it .. Talk softly .. Those kinds of things. Eventually it will gain trust and perhaps may be more interactive.