There is a difference between a hub and a switch.
A hub is a connector or repeater. A network hub is a device that is used to connect more than one computer on a network.
A hub has been in market for long time and is used to connect all nodes or computers on a network to a central location and each node has a unique address called a MAC address. It is called as repeater because when a packet of data is sent through the hub; it is repeated to each computer on the network. For example if there are two computers connected through a hub and I send a picture or file to one computer, this picture or file will be sent to all of the other computers that are connected though a hub.
A network hub is considered as the outdated. The reason that network hub is outdated or obsolete are
1. Availability of low-priced network switches
2. Network bandwidth is consumed as each and every segment is sent to all devices on a network
3. It makes the network extremely slow.
Now a network switch is used which is a specialized device that connects multiple network segments. It is considered as efficient form of the network hub. A switch based network does not send all data (a file, picture or other information) to every device on the network. It will first analyze the MAC address and determine where to send the data. The other devices will no know about this data.