When a host sends a frame to a switch, the switch maps the frame's source MAC address to the port it was received on. Then if a frame with that MAC address as the destination is received, it knows to send that frame on that port. And if it doesn't know what port to send a frame on, it sends it on all ports.
What about if a frame is received from another switch? What if switch A sends switch B 2 frames, both with different source MAC addresses? How does switch B handle that situation?