How are text messages (SMS) sent to an iPhone received in a Mac?
The setting "Text Message Forwarding" on your iPhone uploads/broadcasts all text messages to all verified devices through iCloud.

Your iPhone needs data for this, obviously. Your carrier has nothing do to with this.

All devices need to be logged in to iCloud using the same Apple ID for this to work. Also, you need to verify each device as you enable them in your iPhone's settings.

This setting is part of Apple's Continuity feature set.