The story is detailed in II Chronicles 24, but not in II Kings.
It starts with the death of Jehoiada, the Kohen Gadol that was responsible for overthrowing Athaliah and putting Joash on the throne of Judah, and advising him to follow the right path while he lived, which he did, according to verse 2.
The trouble starts at verse 17, where after burying Jehoiada, the "princes came and prostrated themselves to the King.....and he hearkened to them."
And then verse 18:
"And they forsook the House of the Lord, the God of their fathers, and they worshiped the asherim and the idols, and there was wrath upon Judah and Jerusalem because of this, their guilt."
Verse 19 says prophets were sent to warn him, and then Zechariah gets involved and killed in verses 20-22:
"And the spirit of God enveloped Zechariah the son of Jehoiada the priest, and he stood above the people and said to them, "So said God: Why do you transgress the commandments of the Lord? You will not succeed because you have forsaken the Lord, and He has forsaken you.""
"And they conspired against him and stoned him by the king's command, in the forecourt of the House of the Lord."
"And King Joash did not remember the loving-kindness that Jehoiada his father had done with him, but he killed his son, and upon his death he said, "May the Lord see and requite.""
The rest of the chapter has his punishments for that act - the land was invaded by the Arameans, and his servants conspired and killed him (verse 25)"for the blood of the sonS(more than one might've been killed, since it's in the plural)of Jehoiada the priest"
So, to sum it up, Joash had Zechariah killed because he prophesied the truth to him in public.