It is generally NOT okay to have a 20A circuit breaker on a circuit that has any 14 gauge wire -- and most homeowners won't run into the exceptions
If there's any #14 wire anywhere downstream, you must use a 15A breaker to protect that wire. It's about fire prevention. #14 wire is rated for 15A. Sure, it will carry more, but the N.E.C. ampacity ratings take into account the resistance of the wire insulation to heat and other factors. Bottom line, #14 wire equals 15A breaker.
It's fine (or even required) to oversize the conductors, but not to oversize the breaker (except under rare circumstances that you'll never need to know about unless you become a licensed electrician or wind up doing funny things with motors that invoke Article 430). #12 wire on a 15A breaker is fine. The wire is protected. For longer runs, for example using #12 wire on a 15A breaker or #10 wire on a 20A breaker will reduce voltage drop. There are calculations for wire size related to voltage drop over distance that tell you when you need bigger conductors.
Why was this done?
Hazarding a guess, the person who did it might have had some #14 Romex lying around the garage. Maybe they didn't want to run out and buy some #12, or felt they couldn't afford it. Maybe they bought #14 on purpose just because it was cheaper and they didn't understand the requirements. Or maybe they reasoned that it was okay since the only load on those #14 wires would be the lights, which would never draw more than about an Amp per fixture. That's true enough, technically speaking, as long as nothing ever goes wrong, but it still illegal (actually illegal, because it violates the N.E.C. rules).
But stuff does go wrong, so you never intentionally create a situation that has the potential to start fires or electrocute people.
A few (far from exhaustive) examples of things that could go wrong include; somebody comes along and replaces one of those fixtures with a bigger fixture, or with one of those fixtures with a receptacle on it, or adds a convenient receptacle elsewhere on the 14 gauge stretch of the same circuit, or both. Or something goes wrong with one of the light fixtures that causes it to steadily draw more current than it was meant to, and all of a sudden you have a circuit breaker that will happily feed 20A onto #14 wire for long periods of time.