Housing can be either attached to an existing settlement to become part of it (and benefit from all the already provided services such as food). Or it can be placed independently to establishitself as a new settlement, in that case you need to attach it with service modules.