This passage below sums it up:
(34) For every shepherd is an abomination unto the Egyptians.—This is probably a remark of the narrator, and it is confirmed by the monuments, which generally represent shepherds as unshaven and ill-dressed. Necessarily the Egyptians had sheep and cattle (Genesis 47:16-17), and even Pharaoh had herds (Genesis 47:6); but the care of them was probably left by the peasantry to the women and children, while the men busied themselves with the cultivation of their fields. We need not go far to seek for the cause of this dislike. The word “abomination,” first of all, suggests a religious ground of difference; and not only did shepherds probably kill animals worshipped in different Egyptian districts, but their religion generally was diverse from that of the fixed population. But next, men who lead a settled life always dislike wandering clans, whose cattle are too likely to prey upon their enclosed land (see Note on Genesis 4:8), and who, moving from place to place, are usually not very scrupulous as to the rights of property. Such nomades, too, are generally lower in civilisation, and more rude and rough, than men who have fixed homes. The subjugation of Egypt by the Hyksos was possibly subsequent to the era of Joseph; but we now know from Egyptian sources that there was perpetual war between Egypt and the Hittites, and probably raids were often made upon the rich fields on the banks of the Nile by other Semitic tribes dwelling upon its eastern frontier; and as all these wore regarded as shepherds, there was ground enough for the dislike of all nomades as a class, even though the Egyptians did not disdain to have cattle themselves. But as the land in the Nile Valley was arable, the cattle kept would only be such as were useful for agriculture, whereas they formed the main wealth of the Israelites.