As strategic operations officer, Worf was likely the liaison between DS9 and whatever other Starfleet forces that were deployed in defense of the Bajor Sector. Part of that duty involved periodic command of the Defiant. But then again, Sisko was the Defiant's official commanding officer as the ship was indeed assigned as part of the station's inventory, IMO. Other officers--like Kira, [Jadzia] Dax, and Worf--could take command of the ship on missions as acting captains in his absence.
In the case of First Contact, though, this was the Borg's second attempt to take out Earth, so Starfleet likely called for every ship that was available to intercept them. The Defiant was the only ship that had been specifically built to fight the Borg, so it's prescence at the Battle of Sector 001 was a given.
Sisko, however, was too busy dealing with the Dominion (the war was actually just ramping up to full pitch at that point), so Worf went in his stead...
Free your mind, and the rest will follow.