An investigation is underway after photos of a man pulling a girl’s hair with a grocery cart went viral