How can that be? I thought the first would be the Galaxy, hence the class designation.
Two things should be noted about that quote:
- It specifically refers to the Enterprise-D as a "warship".
- It was spoken by Tasha Yar in the alternate timeline which was created by the reappearance of the Enterprise-C from a temporal rift.
It's possible that in the alternate timeline, the USS Galaxy was built as the prototype starship, then the next Galaxy Class ship commissioned was the Enterprise-D warship for the war with the Klingons. The quote would therefore be correct then in stating that it's "the first Galaxy Class warship".
It was probably just a slip in the script. Likely they meant it was the first constructed excluding the prototype. See USS Galaxy on Memory Alpha.
As far as we know, the first starship in a new class is usually designated as the class name.
The line says "the first Galaxy Class warship built by the Federation"... which could easily mean that the USS Galaxy was indeed the first starship in that class, but the Enterprise-D ended up being the first warship of that class of ships (likely as a result of the war, as Starfleet might have thought that converting the Galaxy class into a more combat oriented vessel was desirable - it certainly was possible as we've seen the USS Venture in the original timeline in DS9 with extra phaser banks on the Warp nacelles - and the Galaxy class as a whole has ample internal space which can be used to adapt to specific purposes - such as housing auxiliary fusion generators perhaps which can feed more power into the shields and weapons - I doubt we'd see more shield generators as ships usually come with 1 primary shield generator and 1 backup which ends up projecting a shield bubble around the ship through the hull grids).
The Enterprise-D was constructed almost at the same time as the USS Galaxy and the USS Yamato. Galaxy launched first, and began operational training exercises. Enterprise ran into issues, like the computer cores not being delivered on time. If you can, pick up a copy of the Star Trek: The Next Generation: Technical Manual, which includes a timeline starting with the Galaxy-class design research and ends with Captain Jean-Luc Picard formally taking command of the Enterprise.