The AMF Selection Logic occurs at the gNB or NSSF. During registration, the gNB uses the 5G-S-TMSI or GUAMI to route to the same AMF. If unavailable, it selects an AMF based on the requested NSSAI, Target PLMN, and capacity weightage to ensure load balancing.