Like all proteins, lysosomal enzymes are coded for by DNA genes, then transcribed into mRNA, which is translated into proteins in the endoplasmic reticulum cisternae.
It is in these cisternae that the proteins are glycosylated and folded. Most* lysosomal enzymes are tagged with a Mannose 6 Phosphate recognition signal, which "addresses" them to the Golgi cisternae ( bearing specific receptors). The cisternae then bud to give birth to the lysosomes.
Therapeutic enzymes are also, in most cases, recognized by the M6P receptors