I think you need to understand a little more about the network layers and how a device implements a network stack. This question is almost off-topic as it is really particular to the OS running on the device, but I will try to give you a general idea.
In a device, you will have a physical interface at layer-1, and your ethernet card with two interfaces has two separate physical interfaces. The card will have a driver that installs in the OS, and the driver will have the layer-2 (ethernet) software for each interface as separate interfaces.
The OS usually implements the layer-3 (IPv4, IPX, IPv6, AppleTalk, etc.) and layer-4 (TCP, UDP, etc.) software. The layer-3 software registers with the layer-2 software so that the layer-2 software knows where to send traffic up to layer-3. An ethernet frame header has an EtherType field that tells the layer-2 to which registered layer-3 module the frame payload should be sent, e.g. 0x800 is for IPv4, and 0x86DD is for IPv6. IANA maintains the IEEE 802 Numbers for the various EtherTypes.
The layer-3 module registered with the layer-2 module for an interface will be assigned the layer-3 address for that interface.
The same type of thing happens for layer-3 and layer-4. For example, IPv4 has the Protocol field in the IPv4 header (IPv6 has a Next Header field that is the same thing). Again, IANA maintains a list, Protocol Numbers, that tells IP to which registered layer-4 module it should send the packet payload.