How to save contacts locally on iPhone

Turn off iCloud for contacts in Settings → iCloud, Contacts. Select "Keep on my iPhone" when asked about previously synced contacts.