Preamble
Firstly, there is a difference in the Greek of Matthew 6:1 that is provided by the TR - Textus Receptus, and that provided by Nestle-Aland. The KJV comes from TR and has ἐλεημοσύνην (alms), whereas the HCSB, for example, comes from Nestle-Aland, and has τὴν δικαιοσύνην (righteousness).
1 Be careful not to practice your righteousness[a] in front of people, to be seen by them. Otherwise, you will have no reward from your Father in heaven. 2 So whenever you give to the poor, don’t sound a trumpet before you, as the hypocrites do in the synagogues and on the streets, to be applauded by people. I assure you: They’ve got their reward! 3 But when you give to the poor, don’t let your left hand know what your right hand is doing, 4 so that your giving may be in secret. And your Father who sees in secret will reward you.[b]
-- Matthew 6:1-4 (HCSB)
Footnotes:
Matthew 6:1 Other mss read charitable giving
Matthew 6:4 Other mss read will Himself reward you openly
My answer arose from the Nestle-Aland text, but it is still applicable, regardless of the Greek text chosen.
Comments
τὴν δικαιοσύνην is what Jesus uses in the sermon on the mount when he says:
Blessed are they which do hunger and thirst after righteousness τὴν δικαιοσύνην: for they shall be filled.
-- Matthew 5:6 (KJV)
τὴν δικαιοσύνην is what Jesus uses later in Matthew 6 to explain the sort of righteousness one should be hungering and thirsting for:
But seek ye first the kingdom of God, and his righteousness τὴν δικαιοσύνην; and all these things shall be added unto you.
-- Matthew 6:33 (KJV)
In Matthew 6:1 Jesus says not to do τὴν δικαιοσύνην ὑμῶν (your righteousness), and then goes on to say in Matthew 6:33 that we should seek τὴν δικαιοσύνην αὐτοῦ (his righteousness). This can only mean that "man's righteousness" is not always the same as "the Father's righteousness". How can they not be the same?
Well, the Father's righteousness glorifies Him, and man's righteousness glorifies him. So, every time a man is glorified, then it's "his righteousness" that achieves it, and every time the Father is glorified, it's "His righteousness" that achieves it. There clearly must be something about what moves a man, such that his glory becomes His glory.
Now, if a man were to do ἐλεημοσύνην (alms, i.e. charitable deeds - Matthew 6:2) in such a way as to glorify himself, then such behaviour is motivated by "his righteousness, not "His righteousness".
In regard to Matthew 5:14, Jesus uses ὑμῶν τὰ καλὰ ἔργα (your good works) to explain what he means by "let your light so shine". ἔργα is a generic term for any activity that occupies one's time. So, what are "good works"?
Good works are those activities that move the community towards a state of goodness, i.e. those typified by heavenly governance, peace, blessing, comfort, healing, and prosperity; and away from a state of evil, i.e. those typified by human governance, discord, distress, misery, injury, and loss.
Good works speak for themselves, and will, in-and-of-themselves, bring esteem to the one who does them. However, Jesus tells us that the PURPOSE of good works is that men should "glorify your Father which is in heaven". To do this, the Father's pleasure must be preeminent in the pursuits of one's heart. However, only the person him/herself and God, are privy to such knowledge.
To do what pleases God one must LEARN what pleases Him, which is the function of Scripture. Besides giving details of His Law, Scripture also documents many, many case studies (OT & NT) concerning what it is about human endeavour that grieves Him, and what it is that brings Him joy.
Anyone can read the text of Scripture and benefit from it words, but the narrative of OT Scripture declares that to LEARN from it God's righteousness, the spirit of God must be the teacher.
26 A new heart also will I give you, and a new spirit will I put within you: and I will take away the stony heart out of your flesh, and I will give you an heart of flesh. And I will put my spirit within you, and cause you to walk in my statutes, and ye shall keep my judgments, and do them. ... 32 Not for your sakes do I this, saith the Lord GOD, be it known unto you: be ashamed and confounded for your own ways, O house of Israel.
-- Ezekiel 36:26,32 (KJV)
The narrative of NT Scripture declares that Jesus Christ is the means through which such transformation of heart is possible.