Jesus was clearly a great healer. For some healings, Jesus would say: “Go and tell no one.” And in some of those cases, the healed told someone despite the instruction of Jesus. Why did Jesus say what he did and what about those who did not comply with His instruction?
The most reasonable explanation is that Jesus did not want to be identified solely as miracle worker. Jesus came as the messiah who would save us from sin and death, not to simply perform healings that would result in people dying eventually. Jesus many times was filled with love and mercy for the people He came across and would perform miracles to alleviate their suffering. However that was not the goal of His mission nor was it the action that He wanted to be solely identified with.
famous miracle workers like Apollonius of Tyana left no lasting followers and no transformative view of the world and life.
Honi ha-M’agel was a Jewish miracle worker who was unjustly killed by religious and civil leaders, yet once again, he left no lasting followers or transformative legacy.
Jesus also didn’t want his disciples to speak openly of Him as the messiah due to the differences between the public’s messianic expectations and the role of messiah that Jesus came to fulfill.
As for why those who were healed and commanded not to tell anyone did so anyways is an open question. I would think they might have thought Jesus’ command to tell no one was an act of humility but they were so overwhelmed by thanks and wonder that they couldn’t help themselves.