The primary function of a companion dog is not to perform a useful job but to provide companionship to humans.
A companion dog can also be called an emotional support animal and is used to help people with mental health disabilities cope with symptoms.
Dogs that have been chosen for traits that make a convenient pet are generally smaller breeds, and the tradition of keeping pretty dogs for no purpose other than to be court decorations stems back thousands of years to Chinese nobility.
In the case of the Pekingese, it was for their lion-like demeanor; for the Pugs, it was for their "lucky" wrinkles and their monkey-like face.
Companion Dog ("CD" added to the dog's registered name) is officially a "Novice obedience Title" in the AKC Competition Obedience Ring, whereby a team enters the "ring" with 200 points, and needs to leave with at least 170 points to "qualify".