First-party games are published by the company that makes the console itself — a Nintendo game on a Nintendo system, for example. Because the platform holder controls both sides, these titles are usually the flagship showcases for the hardware.
Third-party games come from independent studios and publishers with no ownership stake in the platform, which is why the same game often appears on several systems.
Second party isn't a formal industry category, but the label gets used informally for studios that are independently owned yet develop closely and almost exclusively for one platform holder. Strictly speaking, though, most people divide games into first party and third party only.