Your pet won't gain aggro from wandering mobs just by standing there, you actually have to make it attack, so you can't afk level by just letting your pet stand there.
Your pet will however attack mobs that attack you, so if you stand in an area that light blue or weak db to you wander by and attack you say every 5 mins, and you have enough hp and ac to survive the attack easily, you pet will automatically attack whom ever attacks you, thus killing the mob while you are afk.
This really only works well if you and your pet have a regen buff of say 20-30 mins, and as i said before you know the area of the zone will not lead to too many mobs attacking at once. Then you stand in that spot, mobs come by attack you, you do not get hurt bad b/c of your buffs and the regen repairs the damage between mob attacks. Thus while afk for 20-30 mins you gain exp, but not as much as if you were playing.
At level 2 in a newbie with a twink char and buffed and equiped pet, it could probably work you up a few levels with little risk and
I do not think there are many places this would work past level 35 or so. Aslo there are lots of risks. You could be killed by too many mobs on you, or you pet could easily die b/c it chases a fleeing mob and gets aggro from multiple mobs, then of course you would be next.
There is no real safe way to do this, and personally the risks outweigh the reward IMHO