Why does ampicillin in solution turn yellow?
Why is NADH the first thing to come to mind? Time for some physical chemistry.

Beta-lactams has a shorter ring structure which give it a different absorbance (around 322 nm apparently (source needed)) which gives it a blueish hue. Typically Penicillin and Ampicillin start off as an off-white. As hinted by @Mad Scientist, the beta-lactam rings are unstable and will undergo acid-catalyzed hydrolysis which breaks the 4-membered ring.

The Penicillin core also near a ketone which can attack the ketone in the lactam (I'm pretty sure this qualifies as enol chemistry but it has been awhile). The cyclization will form a 5-membered oxazole ring. Based on my experience, unsaturated 5-membered rings will absorb at a higher wavelength tending to result in a yellowish color (570-590 nM) so I am going to suggest that is the source of your color.



Ampicillin degradation