String-derived D4 flavor symmetry and phenomenological implications