A sensible mechanism of the reaction is as follows. Base removes the nitrogen protons leaving a negative charge which moves onto the carbonyl oxygen to form what is known as an enolate (a charged version of the keto-enol tautomerisation you should be familiar with). The oxygen next performs a cyclic addition to the two (previously) carbonyl carbons. Nitrogen is an excellent leaving group because its own bonds are so strong (and as a gas, it is entropically favoured too) so the charge on the oxygens come back down to form carboxylate anions by expelling nitrogen gas. This leaves 3-APA*.
An important point to take note of is the formation of the cyclic peroxide which converts directly to 3-APA*. Chemiluminescent reactions often involve the cleavage of an organic peroxide because this bond is particularly weak and there is much energy to be gained by cleavage and subsequent reorganisation of bonds. This works with the leaving group effect of the nitrogen (above) to form a particularly efficient reaction.