What's this top part of this faucet used for?
That is a backflow preventer, which makes sure that if the water pressure in the house plumbing drops, it doesn't suck water from the hose or whatever the hose might be sitting in.

You can also find information on similar devices by searching for "vacuum breaker".