In sense “mongrel cat”, 1911, of Unknown origin, possibly Cockney. Possibly derived from maggie, margie or mog, all short forms of the female name Margaret.
Original sense, early 19th century, is a term of affection for a calf or cow, which may have been transfered to cats under urbanization. Later 19th century meaning of “untidy woman, slattern”. Alternatively, in Wigan, moggy traditionally applied to mice, not cats, and a cat was hence a moggy catcher, which may have been abbreviated to moggy.