"tamed animal," originally in Scottish and northern England dialect (and exclusively so until mid-18c.), of unknown origin. Sense of "indulged child" (c.1500) is recorded slightly earlier than that of "animal kept as a favorite" (1530s), but the latter may be the primary meaning. Probably associated with or influenced by petty. As a term of endearment by 1849. Teacher's pet is attested from 1890. Pet-shop from 1928.

n.2

"peevishness, offense at feeling slighted," 1580s, in phrase take the pet "take offense." Perhaps from pet (n.1) on a similar notion to that in American English that gets my goat, but the underlying notion is obscure, and the form of the original expression makes this doubtful. This word seems to have been originally a southern English term, while pet (n.1) was northern and Scottish.

v.

1620s, "treat as a pet," from pet (n.1). Sense of "to stroke" is first found 1818. Slang sense of "kiss and caress" is from 1920 (implied in petting). Related: Petted.