all a hub does is take data from one stream, and sends that exact data down several other streams. it doesn't do anything with the data. a very basic device.
you must know that any device that tries to connect to the internet has something called a MAC address, which is a unique address. if you have a switch in the same place as your hub (i.e. between yours computers and your internet connection), then the computers are in their own "area" or "subnet". then, a switch only allows data to cross it if it's going to one of the computers you've connected to it. if the data has no address to say where its going, it doesnt pass the switch.
a router is very similar to a switch, but instead of filtering data due to the MAC address, a router filters using the IP address. so with a router, each connected computer will have theirm IP address being 192.168.2.x typically, or something like that.