These navy ships have ceremonial things they do when they enter and exit ports. Something like this
People stand on the docks and wave and cheer for them as they go by.
And a traditional ship's version would be to have the sailors climb the rigging (vertically) and then spread out standing on top of the yards (a yard is the horizontal spar - the outboard tip is called a yardarm). They are wearing their uniforms and posing as a salute to the place they are leaving. It's called manning the yards or manning the rigging.
This Mexican Navy ship is in its highest parade mode, lit up with every decorative light they have, as a salute to South Street Seaport, New York, etc. They are flying the giant flag and showing off. These Mexican sailors just spent a few days in Nueva Jork. This is the adventure of a lifetime for some of them. Note that the sails are hanging loose below the yards. They are not far from springing into action, setting all of their sails in unison, and pulling off a pretty cool show.
Also, I don't think it's an accident that they are in NYC. It's "Fleet week" up there this week and I suspect this is some foreign relations deal where a lot of foreign countries send their people up there to keep up relations. Love it or not, imagine you're from some small coastal town in Mexico, and your navy gig has you sailing around NYC. These boys were beaming with pride and doing their best. This event is probably pretty embarrassing for the nation.
It looks like they are backing out of South Street assisted by a tug. That means they are using their engines to reverse but the tug is helping push them around. This boat has engines but the windage with all the masts, sails, yards, etc. doesn't work great - they get blown around easily and are exceptionally difficult to maneuver, especially at low speed. The east river isn't a "river" in the sense that it always flows one direction. It is tidal and changes direction and velocity with the tides. It appears to my untrained eye as if they were reversing out and some mechanical failure caused them to either lose power or be stuck in reverse and they just kept reversing into the bridge. If you watch this video, it looks like they hit the dock pretty hard too.
I have seen a lot of commentary online to the effect of "why didn't they know the bridge was too low?" They did. The fucking chart and chartplotter they have on board will both display the bridge clearance which is 38.7 meters. That bridge is made of bricks and steel and has been there a while.
A couple of additional thoughts. These guys can't get out of the rigging until ordered to do so. It's the Navy (Mexican) and they do what they're told.
By the time they realize they're going to have a problem, they have few options. Grab a backstay and slide down? Jump and hope you don't hit anything solid?
If you've never been in a harbor when one of these things goes by, I recommend it. It's pretty cool.