1550s, "impetuous," evidently from pet (n.2) in its "ill humor" sense + -ish. Meaning "peevish, easily annoyed" is from 1590s.
It has naturally been assoc. with PET sb.1, as being a characteristic habit of a "pet" or indulged and spoiled child; but the connexion of sense is not very clear or simple .... [OED]
Related: Pettishly; pettishness.