A hub is a Layer 1 device that broadcasts data to all connected devices on the same LAN, while a switch is a Layer 2 device that sends data only to the intended recipient based on their MAC address. This makes switches more efficient than hubs, as they reduce network congestion and improve network security.