The original plan for the introduction of the Borg Collective in Star Trek: The Next Generation was abandoned due to industrial action by the Writers' Guild of America, but its replacement made the Borg and the character of Captain Jean-Luc Picard (Patrick Stewart) much better as a result. The Borg first appeared in Star Trek: TNG season 2, episode 16, "Q Who", when the USS Enterprise-D was stranded in the Delta Quadrant by Q (John de Lancie) to petulantly prove why Picard needed his knowledge and expertise.
While it's never been made explicit in canon, the Borg made their first appearance in the TNG season 1 finale, albeit as an unknown force. In "The Neutral Zone", Captain Picard and the Enterprise were sent to the titular region of space to investigate mysterious attacks on Romulan and Federation outposts. The identity of the attacker remained a mystery because the 1988 WGA strike, which lasted for 153 days, halted all work on Star Trek: The Next Generation season 2's scripts. Showrunner Maurice Hurley, writer of "The Neutral Zone" had always intended the attackers to be the Borg, with their introduction playing out in a very different way to what would eventually end up on screen.