Original: The pox is related to the vaccinia virus, and got its name from the distribution of the disease when dairymaids touched the udders of infected cows.
Simplified: After infection with the disease, the body (usually) gains the ability recognize the similar smallpox virus from its antigens and so is able to fight the smallpox disease much more efficiently.