It's a nominalized adjective (similar to forms *мороженое, жаркое* etc.) derived from the CS word *запѧти* (to stop). So *запятая* means "stopped". The Russian word *препинание* (as in *знаки препинания*, "punctuation") derives from the same root. Unlike most CS and Russian linguistic terms, it's not a calque from a Latin or Greek term, which means it appeared very early. Zizany and Smotritsky both mention it in their grammars.