To gather experience and level up pets, you just need to use it while grinding.
Whereas for goblin, (from what I heard) it is bugged or broken, so it can't level up and will stay at level 1.
Most pets can level up, and except goblin I don't know if there's other pet with same issue too.