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.
Best Answer
If you are asking about wiring in conformance with the USA National Electrical Code, 15 amp receptacles are often used with 12 gauge wire. The only problem may be in using the quick-connect feature where you just stick the wire in a hole and it is automatically caught and retained. Those are only for 14 gauge wire. With 12 gauge, you need to use the screw terminals. You can use 15 amp outlets on either 15 or 20 amp circuits. 12 gauge wire is the minimum for 20 amp circuits. 14 gauge wire is the minimum for 15 amp circuits. Knowing the proper wire size is only one of many requirements for wiring. If you have to ask about that, there are probably other things that you don't even know to ask about. Do you know how to determine how many wires are allowed in a given size box?