The account you are referencing is found in Luke 5:12-14: (NASB1995) While he was in one of the cities, behold, there was a man covered with leprosy; and when he saw Jesus, he fell on his face and implored him, saying, “Lord, if you are willing, you can make me clean.” And he stretched out his hand and touched him, saying, “I am willing; be cleansed.” And immediately the leprosy left him. And he ordered him to tell no one, “But go and show yourself to the priest and make an offering for your cleansing, just as Moses commanded, as a testimony to them.” But the news about Him was spreading even farther, and large crowds were gathering to hear him and to be healed of their sicknesses. But Jesus himself would often slip away to the wilderness and pray.

We have three suggestions why Jesus asked the leper to keep the miracle to himself. 

  1. In the specific case in Luke 5, Jesus wanted the man to take the official steps to be declared clean in order to be readmitted to society and permitted to return home to their families. See Leviticus 14 for the Law on this procedure.
     
  2. We can see from this account (and others) that as soon as word got out that Jesus was healing and performing miracles, crowds showed up. He needed to have private time to commune with His Father in prayer. We also know healings cost Jesus physically and probably emotionally as well from the account in Luke 8:46, where Jesus says, “Someone touched me; I know that power has gone out from me,” when a woman touched his cloak. It seems he might have been at a time or place with this leper where he wanted to delay having a big crowd around him clamoring for his time, attention and miracles.
     
  3. As Jesus was becoming ever more popular with the Jewish people, envy and opposition from their religious leaders (the scribes and Pharisees) was growing. Therefore, Jesus did not want to draw any more attention to himself than was needed. He did not want the Jews to proclaim him king since such a proclamation could have precipitated a crisis before Jesus’ ministry was completed. The time had not yet come for him to die. He had other work to do and that work needed to be done on a specific timeline and in a specific way. He did not want a crisis to occur between him and the Jewish leaders before the appointed time.