What does Matthew 6:6 mean?
To some of Jesus' listeners, His teaching to do righteous things in secret may have sounded radical. In highly religious and even legalistic communities, it's easy to think that the point of religious activity is to be seen by others. Societies that stress honor versus shame put a high priority on appearing acceptable to your family members, neighbors, and church community. Jesus turns this upside down and warns that if the opinion of other people is the only motive, God will not reward such actions. Instead, Jesus commands His followers to give to the needy as secretly as possible to avoid even the possibility of mixed motives (Matthew 6:1–4).For the same reasons, Jesus has said that regular prayer to the Father should be done in secret, behind closed doors (Matthew 6:5). The Father will still hear and reward you, and He is the only audience that matters.
This command should not be read as forbidding any kind of public praying in church or anywhere else. It is good for Christian behavior to shine like a light in the world (Matthew 5:16). What Jesus condemns, here, is for those praying in public—including church services and other events—to be aware of their motives. If they cannot pray publicly without feeling as if they are "performing" for other listeners, it is better to pray silently or in a private setting, instead.