Whenever your lymphocytes (a type of white cell from the adaptative immune system, the one that adapts to intruders) are activated to kill a pathogen, most transform into killing machines, but a small part evolve into memory cells, which then go on to live for very long in an inactive state, waiting to be reactivated if the pathogen comes back.
This is done because reactivating a memory cell is much faster than activating a brand new lymphocyte.
To answer the secondary question, they’re stored wherever there are lymphocytes, so mostly lymph nodes and the spleen.
Latest Answers