Did you ever wonder why a simple carpenter was called Rabbi? A rabbi is a teacher, a master in spiritual things. And it wasn't just His twelve friends who called Him, Rabbi. Everyone did, including the Pharisees. (Matt. 19:16, 22: 35-36, Luke 12: 13, John 3: 1-2.
He must have earned the title, Rabbi, with is knowledge of scripture and law, or He wouldn't have gained their respect. "Rabbi, we know that You are a teacher who has come from God. For no one can do these signs that You do unless God is with Him." John 3: 1-2.