First, the mRNA vaccine is injected into the upper-arm (the deltoid) muscle. There is no spike protein in the mRNA vaccines; the vaccines contain mRNA wrapped in lipid-nanoparticles (LNPs) – like tiny tapioca balls in bubble tea – that help them enter your cells.
After the mRNA vaccine enters your cells, the cells use the mRNA as instructions to create a piece of the inactivated spike protein. The mRNA does not enter the nucleus of your cell, and does not interact with your DNA – it's one and done, and is destroyed after the protein is created.
Finally, the new proteins move to the surface of your cells, where they can be detected by your immune system. They don't leave your cells like viral proteins – they're stuck to the cell's surface by specially designed anchor regions. Once your immune system detects these proteins, it begins to create antibodies that protect you from COVID-19.