I have no idea how is came about or what caused it.
I would flush the eye with saline, try to remove that yellow pus, it may not come out at first, but that's o.k. Once you flush the eye, then put an ointment like Terramycin eye ointment into the eye. Repeat the steps at least 2-3X a day.