According to the mechanism shown below, the amino group (–NH₂) of the amino acid undergoes condensation with the middle carbonyl group (C=O) of indanetrione, which is formed from nionhydrin. Then, the –COO⁻ group are released as CO₂ gas.
It is the amino groups of amino acids that react with ninhydrin. The complete reaction scheme is shown on the Wikipedia page about ninhydrin: https://en.wikipedia.org/wiki/Ninhydrin