David went to Jerusalem with his father. David had 8 brothers and among them he was the youngest. His father was an elder of the city. At that time Saul was the king.
David wanted to fight Goliath but all he had was a sling. He picked up a rock and shot Goliath. The first shot didn't do anything but the second one hit him in the face and cracked his skull.