Jesus knew his initial popularity would soon wear off because his mission did match the traditional view of the Messiah. Even Nicodemus, a sympathetic educated leader, didn't understand Jesus' mission. Nicodemus quieted down when his defending Jesus met resistance (John 7:50-52).
Note that "believed" and "entrusting" are the same verb in Greek. "Believed" is aorist active indicative; thus, a past action with no indication of continuing. "Entrusting" is imperfect active indicative; thus, continuing action in the past. The pronouns give it the reflexive meaning.
Ὡς δὲ ἦν ἐν τοῖς Ἱεροσολύμοις ἐν τῷ πάσχα °ἐν τῇ ἑορτῇ,* πολλοὶ ἐπίστευσαν εἰς τὸ ὄνομα αὐτοῦ θεωροῦντες αὐτοῦ τὰ σημεῖα ἃ ἐποίει·* 24 αὐτὸς δὲ ⸀Ἰησοῦς οὐκ ἐπίστευεν ⸁αὐτὸν αὐτοῖς διὰ τὸ αὐτὸν γινώσκειν πάντας 25 καὶ ὅτι οὐ χρείαν εἶχεν ἵνα τις μαρτυρήσῃ περὶ τοῦ ἀνθρώπου·* αὐτὸς γὰρ ἐγίνωσκεν τί ἦν ἐν τῷ ἀνθρώπῳ.
(John 2:23–25, NA28)
Note: the participle "observing" can be translated "because they observed."
So Jesus said to him, “Unless you see signs and wonders you will not believe.”
(John 4:48, ESV)
See What is/was the significance of Jesus’s response regarding sign-seeking in John 4:48?
Jesus answered them, “Truly, truly, I say to you, you are seeking me, not because you saw [understood my] signs, but because you ate your fill of the loaves.
(John 6:26, ESV)
See What did Jesus mean in John 6:26?
Many of the Jews therefore, who had come with Mary and had seen what he did, believed in him, 46 but some of them went to the Pharisees and told them what Jesus had done.
(John 11:45–46, ESV)
Jesus had to be careful who he revealed himself to until the time of his crucifixion drew near. Note in John 14 - 16 how much he waited to reveal even to the twelve just before his crucifixion. Even that was actually to the eleven.
Appendix: Various Interpretations
J. P. Lang list the possible interpretations:
Ver. 24. Did not commit himself unto them. —The second πιστεύειν ἑαυτόν is evidently connected with the first πιστεύειν. He believed not in their believing, to such a degree as to commit or deliver up Himself to them. Various interpretations: (1) He withheld His doctrine (Chrysostom, Kuinoel); (2) He did not yield Himself to personal intercourse with them (Meyer). Without doubt simply: He did not yet entrust Himself to them as the Messiah, did not offer Himself as the Messiah, though they seemed inclined to recognize Him as such. It is the Lord’s determination, not to appear publicly under the title of Messiah; and He follows it henceforth till the triumphal entry into Jerusalem; in full accordance with Matth. 4:1–11.
Lange, J. P., & Schaff, P. (2008). A commentary on the Holy Scriptures: John (p. 119). Bellingham, WA: Logos Bible Software.
William Barclay's interpretation:
It is a great characteristic of Jesus that he did not want followers unless they clearly knew and deﬁnitely accepted what was involved in following him. He refused to cash in on a moment’s popularity. If he had entrusted himself to the mob in Jerusalem, they would have declared him Messiah there and then and would have waited for the kind of material action they expected the Messiah to take. But Jesus was a leader who refused to ask anyone ever to accept him until the full implications of that acceptance were understood. He insisted that people should know what they were doing.
Barclay, W. (2001). The Gospel of John (Rev. and updated., Vol. 1, p. 138). Edinburgh: Saint Andrew Press.
R. E. Brown:
24-25. A faith based merely on miracles without a proper recognition of the nature of him who performed them would prove to be unstable and inconstant. The same idea occurs in 6:2. Jesus, who is truly man but endowed with the wisdom of God, labors under no illusions concerning human frailty.
Brown, R. E., Fitzmyer, J. A., & Murphy, R. E. (1996). The Jerome Biblical commentary (Vol. 2, p. 429). Englewood Cliffs, NJ: Prentice-Hall.