Problem: When David killed Goliath and cut his head off, the city of Jerusalem was still in the hands of the Jebusites. David did not conquer the city until much later (2 Sam. 5:6–9).
Solution: It does not say that Goliath’s head was taken immediately to Jerusalem. But David took his trophy there eventually when he made Jerusalem the place of his throne.