The primary meaning of pest is an animal which has characteristics which people regard as being injurious or harmful. It can also refer to plants (weeds). Pesticides are chemicals designed to kill, retard growth, or prevent reproduction of pests. (Please see also: Pest control.)
By extension, pest can refer also to a contagious deadly disease, a pestilence such as the Bubonic plague.
By further analogy, pest in the slang sense can refer to an annoying person, especially one difficult to get rid of.