Of course Jesus accepts usage of "good" - ἀγαθός - with reference of men ("A good /ἀγαθός/ man brings out good things /ἀγαθά/ out of the treasury of good heart" /Matt 12:35/), however goodness as a divine uncreated quality does not belong to humans properly, but only by participation, which is clear from Jesus' other utterances, when He says that "those who practice truth come to light to manifest their deeds, for those deeds are done in God" (ἐν θεῷ ἐστιν ἐργασμένα) (John 3:21). Now, truth as the uncreated divine feature, alongside with goodness, also does not belong properly to men, but only by participation, and that's why it is emphasized that man cannot be truthful unless by participating in God, for exactly this is the meaning that the truthful deeds are done "in God" in John 3:21. Now, Jesus does not possess truth by participation, but properly, so that it is an ontological impossibility for Him not to possess truth, to make an analogy, it is an ontological impossibility for water not to be wet or for a circle to have angles, therefore He affirms it by saying "I am the Truth" (John 14:6).
And the same is true with the divine uncreated feature of goodness, to the effect that Jesus can say "I am the Goodness", which He says many times implicitly, for when He negates any possibility for anybody to access Father without Him, then He asserts simply His ontological inseparability from the Father, thus the source of Goodness for us is not only Father, but Father always together with the Son.
Now, in Mark 10:18 Jesus sees the inner intent and meaning of the fellow addressing Him: that he thinks that Jesus is just a good person, a good teacher who possesses goodness by participation, as any other good man. And that's why He elevates the questioner's mind, reprimanding him for belittling His status: "only God is good in the proper sense, so why are you calling Me 'good'? Do you believe Me to be God?" - thus, He both reprimands him for not thinking properly about Him, and at the same time directs his mind to understanding His divinity, that He possesses goodness not by participation, but properly, as the Father does, for He had performed miracles without prayers and invocations of the name of the Father, but out of His own authority, showing thus that His divine deeds are the same deeds as those of the Father, metaphorically calling His own deeds "finger of God" (Luke 11:20) indicating by this metaphor, that God cannot do anything but through Him, to the effect that Their divine activity is one (although the Son has also human activity which the Father does not have, but this is another issue).
Similar harsh reprimanding of Jesus was addressed to Nicodemus, that the latter could not see correctly, due to the reason that he was not born anew (John 3:3), because Nicodemus called Him a one "with whom was God" for no man could do such deeds without God being with him (John 3:2), thus belittling Jesus to a human status, having failed to see that it was not that God was with Jesus, but that Jesus did God's deeds out of His, Jesus', own authority, thus God was doing those deeds through Him and could not do otherwise any more than He could create the universe without His Logos.
Thus, He says by His question "why are you calling me good? Only God is good" that either he should not call Him good at all, if he does so with an intent to reduce His goodness to a human participatory goodness, or to call Him "good" in the same sense as God is good, for God is absolutely impotent to perform any good deed through which He is known and manifested to be good, but through His Son.
And the final of the conversation indicates just that: no prophet or good teacher could dare to change the law and say that "law is not enough, I am greater than law and follow me in order to inherit God's kingdom!" - this would be regarded from any prophet or a good teacher either as a blatant stupidity, or as a very bad joke flirting with a sacrilege, or as the very sacrilege - a blasphemy worthy of a death penalty. But Jesus provocatively utters just that "blasphemy", because as the Son of God He is above the law and can authoritatively change its relative status, moreover, substitute it altogether by His own Person.