When a hunter tames a new pet, its default name will be the type of beast it is, such as "Boar". You can set a new name by right-clicking the pet's portrait in the upper-left part of the screen. You can only rename each pet once, so choose carefully, and remember that the naming policy also applies to pet names.
Each individual warlock will always summon the same imp, the same voidwalker, and so on. A name is randomly assigned the first time that a particular demon is summoned, and that name is permanent and cannot be changed.
"Vanity pets" such as cats, snakes, cockroaches, and Collector's Edition pets cannot be assigned names.