This is an interesting situation where Paul and his friends knew he was go to Jerusalem and suffer, as directed by the Holy Spirit. I’d like to echo @tsbehan that there is definitely human element here in the love and concern the people have for Paul.
This begins begins earlier in Acts as he is living in Ephesus:
Acts 19:21 NASB
 Now after these things were finished, Paul purposed in the Spirit to go to Jerusalem after he had passed through Macedonia and Achaia, saying, “After I have been there, I must also see Rome.”
Then later during his fairwell to the Ephesians, he recalls the time he spent, and reaffirms the reason for his departure. He also does not hide that the Spirit’s leading includes a warning to prepare for great affliction:
Acts 20:22-24 NASB
 And now, behold, bound by the Spirit, I am on my way to Jerusalem, not knowing what will happen to me there,  except that the Holy Spirit solemnly testifies to me in every city, saying that bonds and afflictions await me.  But I do not consider my life of any account as dear to myself, so that I may finish my course and the ministry which I received from the Lord Jesus, to testify solemnly of the gospel of the grace of God.
Paul, prepared to die for his Lord, was open about the risks involved and was going to face them head on. After his departure, Paul and his traveling companions landed in Tyre where they looked up other disciples. This is where we get to the key passage in question of Acts 21:4…
Acts 21:4-6 NASB
 After looking up the disciples, we stayed there seven days; and they kept telling Paul through the Spirit not to set foot in Jerusalem.  When our days there were ended, we left and started on our journey, while they all, with wives and children, escorted us until we were out of the city. After kneeling down on the beach and praying, we said farewell to one another.  Then we went on board the ship, and they returned home again.
Paul gets further confirmation later in 21:10-14.
I believe that there is no disharmony here. In multiple, successive events, the Spirit is moving through the Christian communityto make them aware of His plans for Paul. Luke does not appear to be revealing a different message in 21:4, and through the Spirit (dia tou pneumatos) is related to revealing the situation Paul was to undergo. The people had a spiritual feeling to Paul (liken to Gal. 5:22), and were urging him not to go. However, even though Paul was being made aware of the dangers, the Spirit was not prohibiting. I think it is important to note that the people also stopped and prayed with Paul in support for the Lord’s will to be done, not their’s or Paul’s (Acts 20:36, 21:5, 21:14).
Let me know if any of that helps or if there are any points I may have overlooked.
 David G. Peterson, The Acts of the Apostles in The Pillar New Testament Commentary, ed. D. A. Carson (Grand Rapids: Eerdmans, 2009) 578.