Give the yellowed area a swipe with a dry rag, then a lukewarm wet one, scrubbing lightly to make sure the yellowing isn't some substance that you can clean off. Take this step before you go about attempting to remove what otherwise is likely chemical yellowing caused by oxidation over time.
Wipe at the yellowed areas of the trim with a rag or chemical sponge treated with paint thinner. Yellowed paint requires removal to fully restore the trim to its previous white coloring. Wear rubber gloves and ventilate the room because paint thinner has strong fumes and can irritate or burn the skin.
Apply a small amount of water to a clean rag to rinse away any remaining paint thinner from the trim once you have stripped away the yellowed paint.
Apply a fresh coat of white oil paint to the trim, using a paintbrush, to renew its appearance. Paint the entire trim so the paint job matches throughout. If you paint over only the yellowed area, you'll see where the old paint ends and the new paint begins.