pet (n.1) Look up pet at Dictionary.com
"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.
Know nature's children all divide her care;
The fur that warms a monarch warm'd a bear.
While man exclaims, 'See all things for my use!'
'See man for mine!' replies a pamper'd goose:

[Alexander Pope, "Essay on Man"]
pet (n.2) Look up pet at Dictionary.com
"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.
pet (v.) Look up pet at Dictionary.com
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.