Because the mRNA injected gets into cells and uses the cells machinery to produce the spike protein “signature” which is then identified by the body as a threat and generates antibodies to defend against it.
You skipped a few steps:
The ribosomes use the mRNA blueprint (note: this molecule is not a Spike Protein) to translate into spike proteins (antigens) which are then broken up into fragments or taken up by helper T cells by MHC class II proteins. The process is a closed system which creates antibodies and cytolytic molecules, such as perforin and granzyme.