[Additional info from Reddit]

"The cardinalfish is actually trying to nom an ostracod - a type of wee free-swimming crustacean - which releases two compounds, luciferin and luciferase, that react to form the blue-ish bioluminescence observed. Idea being that, once swallowed, the release of the bioluminscent liquid from the ostracod will draw the attention of nearby predators to the fish. The fish, not wanting to be nommed itself, spits out the ostracod and its trickery and lives to tell the tale.

The GIF is from the BBC’s Attenborough’s Life that Glows documentary"