What is a "residency requirement" in the context of Canadian and US PhD programs?
Generally, in the context of a doctoral degree, "residency requirement" refers to some minimum number of credits that must be completed at the degree-granting institution, or minimum duration during which the degree candidate must be enrolled full time at the degree granting institution. In contrast, work completed at another institution and applied toward the degree does not count towards the residency requirement.  See e.g. policy statements here , here, and here, which make it clear that this is the kind of residency requirement they're referring to.

But "residency requirement" is occasionally used in other ways - for example, here it refers to students being considered in-state residents for admissions and tuition purposes.

It is very unusual but not unheard of for doctoral students to be required to live on campus for some time. See this Google search. I am not aware of any US or Canadian universities that have this requirement.