A hub is a networking device that connects multiple computers to a single network using Ethernet, Firewire, or USB connections. It operates at the physical layer of the OSI model and broadcasts all incoming data to all ports, which can cause collisions. A switch is a networking device that connects network segments and operates at the data link layer. It stores MAC addresses in a lookup table to route data only to necessary ports, preventing collisions. Switches allow full duplex communication and the implementation of features like VLANs, spanning trees, and more advanced routing capabilities compared to hubs.