A switch is a box with a bunch of Ethernet wires coming into it:
+--------------------+
| +-+  +-+  +-+  +-+ |
| |1|  |2|  |3|  |4| |
| +-+  +-+  +-+  +-+ |
+--------------------+
Except that it doesn't have to be Ethernet, e.g. it would also be a Wi-Fi.
What the switch does is:
  • an Ethernet request came in from wire 1
  • decide which wire to send it out on, e.g. wire 2, 3, 4, 5, etc. You likely don't want to send it back through 1 where it came from.
After the destination is found, a confirmation is somehow sent back to the switch, which then learns which wire to send each MAC address to.
A switch is a bit like a router but it is a bit dumber/operates at a lower level: it basically operates only on MAC addresses, not on IP addresses.
The Internet service provider boxes most people have at home combines a switch for the local network and a router for the ISP communication.