Short answer
Being good is needed, but it is not the whole of what we owe. Confucius taught that goodness is to love others, and not to do to others what you would not want done to yourself. Islam commands kindness too: to parents, kin, the needy, and neighbours near and stranger. It commands justice to everyone. It also asks for ihsan (excellence): to worship Allah (﷾) as if you saw Him. What goodness alone leaves out is the One who made us and to whom we return. The Qur'an asks for belief in God (﷾) and His messenger, and says no other religion will be accepted (3:85). It also says that God (﷾) sends no wrath until a messenger has come (17:15). So belief is asked once the message has reached a person.
Full explanation
What Confucius taught about being good
Confucius taught ren, the full goodness of a person, often put in English as "humaneness". Legge, whose 1861 English translation is quoted here, renders it "benevolence" or "perfect virtue". Asked about benevolence, Confucius said it is "to love all men" (12.22). Asked about perfect virtue, he named, among other things, not doing to others what you would not wish done to yourself (12.2). Asked for one word to guide all of life, he answered with reciprocity, called shu in Chinese (15.23). The person of fine character is the junzi, Legge's "superior man". That person's mind is set on righteousness, not gain (4.16). He also stands in awe of the ordinances of Heaven (Tian) (16.8). Tian is Confucius's word, and this page does not treat it as another name for Allah (﷾).
“Fan Ch'ih asked about benevolence. The Master said, 'It is to love all men.'”
“Chung-kung asked about perfect virtue. The Master said, 'It is, when you go abroad, to behave to every one as if you were receiving a great guest; to employ the people as if you were assisting at a great sacrifice; not to do to others as you would not wish done to yourself; to have no murmuring against you in the country, and none in the family.'”
“Tsze-kung asked, saying, 'Is there one word which may serve as a rule of practice for all one's life?' The Master said, 'Is not RECIPROCITY such a word? What you do not want done to yourself, do not do to others.'”
“The Master said, 'The mind of the superior man is conversant with righteousness; the mind of the mean man is conversant with gain.'”
“There are three things of which the superior man stands in awe. He stands in awe of the ordinances of Heaven. He stands in awe of great men. He stands in awe of the words of sages.”
Islam commands kindness and justice too
The Qur'an joins the worship of Allah (﷾) to doing good to parents, kin, the needy and neighbours who are strangers (4:36). It commands justice even towards people one hates (5:8). Allah (﷾) does not forbid kind and just dealing with those who do not fight Muslims for their faith or drive them out (60:8). The Prophet (ﷺ) said that none of you truly believes until he loves for his brother what he loves for himself. The narrator was unsure whether he said "his brother" or "his neighbour" (Muslim 45a). He also said that among the best of you are those with the best character (Bukhari 3559). The Qur'an says that he stood on an exalted standard of character (68:4).
“Serve Allah, and join not any partners with Him; and do good- to parents, kinsfolk, orphans, those in need, neighbours who are near, neighbours who are strangers, the companion by your side, the wayfarer (ye meet), and what your right hands possess: For Allah loveth not the arrogant, the vainglorious;-”
“O ye who believe! stand out firmly for Allah, as witnesses to fair dealing, and let not the hatred of others to you make you swerve to wrong and depart from justice. Be just: that is next to piety: and fear Allah. For Allah is well-acquainted with all that ye do.”
“Allah forbids you not, with regard to those who fight you not for (your) Faith nor drive you out of your homes, from dealing kindly and justly with them: for Allah loveth those who are just.”
Anas ibn Malik reports that the Prophet (ﷺ) said that none of you truly believes until he loves for his brother what he loves for himself. The wording is "his brother", and the narrator adds that the Prophet (ﷺ) may have said "his neighbour" in its place.
Abdullah ibn Amr reports that the Prophet (ﷺ) was never indecent in speech, nor one who tried to be, and that he used to say that among the best of you are those with the best character.
“And thou (standest) on an exalted standard of character.”
When someone wrongs you
Confucius was asked whether to repay an injury with kindness. He answered that injury is repaid with justice, and kindness with kindness (14.36). The Qur'an allows an equal recompense for an injury. It adds that whoever forgives and makes peace has his reward from Allah (42:40). It also says to repel evil with what is better, and then the one who hated you will become as a close friend (41:34).
“Some one said, 'What do you say concerning the principle that injury should be recompensed with kindness?' The Master said, 'With what then will you recompense kindness? 'Recompense injury with justice, and recompense kindness with kindness.'”
“The recompense for an injury is an injury equal thereto (in degree): but if a person forgives and makes reconciliation, his reward is due from Allah: for (Allah) loveth not those who do wrong.”
“Nor can goodness and Evil be equal. Repel (Evil) with what is better: Then will he between whom and thee was hatred become as it were thy friend and intimate!”
Ihsan: excellence in worship
Islam asks for more than right acts. In a famous report (hadith), the angel Gabriel came as a stranger and asked the Prophet (ﷺ) about ihsan. The Prophet said it is to worship Allah (﷾) as if you see Him. He added that though you do not see Him, He sees you (Muslim 8). Good character grows from that. The Qur'an says that righteousness is not in turning your face to east or west. It is to believe in Allah (﷾), the Last Day, the angels, the Book and the messengers. It is also giving out of love for Him, prayer, charity, keeping promises and patience (2:177). The Qur'an also says that Allah (﷾) is with you wherever you are, and sees what you do (57:4).
Umar ibn al-Khattab reports that a stranger in very white clothes asked the Prophet (ﷺ) about Islam, faith and ihsan (excellence). Asked about ihsan, the Prophet said it is to worship Allah as if you see Him, for though you do not see Him, He sees you. Afterwards the Prophet told Umar the stranger was Gabriel, who had come to teach them their religion.
“It is not righteousness that ye turn your faces Towards east or West; but it is righteousness- to believe in Allah and the Last Day, and the Angels, and the Book, and the Messengers; to spend of your substance, out of love for Him, for your kin, for orphans, for the needy, for the wayfarer, for those who ask, and for the ransom of slaves; to be steadfast in prayer, and practice regular charity; to fulfil the contracts which ye have made; and to be firm and patient, in pain (or suffering) and adversity, and throughout all periods of panic. Such are the people of truth, the Allah-fearing.”
“He it is Who created the heavens and the earth in Six Days, and is moreover firmly established on the Throne (of Authority). He knows what enters within the earth and what comes forth out of it, what comes down from heaven and what mounts up to it. And He is with you wheresoever ye may be. And Allah sees well all that ye do.”
What goodness alone leaves out
Confucius, too, taught awe of Heaven (16.8). But he did not teach that Heaven had sent a message in words. Once, when he said he would rather not speak, he asked, "Does Heaven speak?" (17.19). Islam says that the One who made us has spoken, by sending messengers (42:51). The verse on kindness puts His right first. It says to serve Allah (﷾) and join no partners with Him, and then to do good to parents and others (4:36). The Qur'an says to serve Allah (﷾), offering Him sincere devotion (39:2). It also says that every soul will taste death, and that to Allah (﷾) we return (21:35). Islam does not say that people of other faiths, or of none, cannot do good. It says that good deeds and faith go together. Whoever does good deeds and has faith will enter Paradise, and will not be wronged in the least (4:124).
“There are three things of which the superior man stands in awe. He stands in awe of the ordinances of Heaven. He stands in awe of great men. He stands in awe of the words of sages.”
“The Master said, 'I would prefer not speaking.' Tsze-kung said, 'If you, Master, do not speak, what shall we, your disciples, have to record?' The Master said, 'Does Heaven speak? The four seasons pursue their courses, and all things are continually being produced, but does Heaven say anything?'”
“It is not fitting for a man that Allah should speak to him except by inspiration, or from behind a veil, or by the sending of a messenger to reveal, with Allah's permission, what Allah wills: for He is Most High, Most Wise.”
“Serve Allah, and join not any partners with Him; and do good- to parents, kinsfolk, orphans, those in need, neighbours who are near, neighbours who are strangers, the companion by your side, the wayfarer (ye meet), and what your right hands possess: For Allah loveth not the arrogant, the vainglorious;-”
“Verily it is We Who have revealed the Book to thee in Truth: so serve Allah, offering Him sincere devotion.”
“Every soul shall have a taste of death: and We test you by evil and by good by way of trial. to Us must ye return.”
“If any do deeds of righteousness,- be they male or female - and have faith, they will enter Heaven, and not the least injustice will be done to them.”
What Islam asks, stated exactly
The Qur'an says that if anyone desires a religion other than Islam, it will never be accepted of him. In the Hereafter he will be among those who have lost (3:85). It also says that Allah (﷾) would not visit with His wrath until He had sent a messenger (17:15). So belief in God (﷾) and His messenger is asked once the message has reached a person. Muslims do not ask forgiveness for those who died outside Islam (9:113). Yet no Muslim may declare any particular person's fate. That belongs to Allah (﷾), who is never unjust in the least degree (4:40). The page on people who never heard the message takes this further.
“If anyone desires a religion other than Islam (submission to Allah), never will it be accepted of him; and in the Hereafter He will be in the ranks of those who have lost (All spiritual good).”
“Who receiveth guidance, receiveth it for his own benefit: who goeth astray doth so to his own loss: No bearer of burdens can bear the burden of another: nor would We visit with Our Wrath until We had sent a messenger (to give warning).”
“It is not fitting, for the Prophet and those who believe, that they should pray for forgiveness for Pagans, even though they be of kin, after it is clear to them that they are companions of the Fire.”
“Allah is never unjust in the least degree: If there is any good (done), He doubleth it, and giveth from His own presence a great reward.”
Islam's answer: a whole way of life
Islam is a whole way of life: belief, worship, law, family and character together. The Qur'an says that Allah (﷾) has perfected the religion and chosen Islam for you (5:3). It calls believers to enter Islam whole-heartedly (2:208). The page called What is Islam? shows it whole. Read the Qur'an in a translation you trust, and test it (2:23). Then ask whether Muhammad (ﷺ) is the last prophet God (﷾) sent (33:40).
“This day have I perfected your religion for you, completed My favour upon you, and have chosen for you Islam as your religion.”
“O ye who believe! Enter into Islam whole-heartedly; and follow not the footsteps of the evil one; for he is to you an avowed enemy.”
“And if ye are in doubt as to what We have revealed from time to time to Our servant, then produce a Sura like thereunto; and call your witnesses or helpers (If there are any) besides Allah, if your (doubts) are true.”
“Muhammad is not the father of any of your men, but (he is) the Messenger of Allah, and the Seal of the Prophets: and Allah has full knowledge of all things.”
Replies, one by one
Qur'an 3:85 — Surat Al Imran (The Family of Imraan), verse 85
“If anyone desires a religion other than Islam (submission to Allah), never will it be accepted of him; and in the Hereafter He will be in the ranks of those who have lost (All spiritual good).”
Cited for
Your Qur'an says good people of other faiths are lost. So my good grandmother is in Hell.
The response
No Muslim may declare any particular person's fate, your grandmother's included. That belongs to Allah (﷾) alone, who wrongs no one in the least degree (4:40). He sends no wrath until a messenger has come (17:15). Muslims do not ask forgiveness for those who died outside Islam (9:113). That is a rule for a Muslim's own prayers, not a verdict on her. The pages on honouring ancestors and on people who never heard the message say more.
Where it lands — Islam states its rule openly. It asks for belief once the message has reached a person, and leaves each person's fate to Allah (﷾), who wrongs no one.
Qur'an 3:85 — Surat Al Imran (The Family of Imraan), verse 85
“If anyone desires a religion other than Islam (submission to Allah), never will it be accepted of him; and in the Hereafter He will be in the ranks of those who have lost (All spiritual good).”
Cited for
If I am kind and honest, a just God would not reject me for getting belief wrong.
The response
Islam agrees that God (﷾) is just. He wrongs no one in the least degree (4:40), and sends no wrath before a messenger has come (17:15). Allah (﷾) alone knows whether His message truly reached a person. And belief is not a blind guess. The Qur'an gives its evidence and asks to be tested (2:23). It also puts thanks to the One who gave us life beside thanks to parents: "Show gratitude to Me and to thy parents" (31:14). A kind person would not ignore his own parents. Islam asks him not to ignore his Maker.
Where it lands — God (﷾) judges each person justly. The message gives its reasons, and turning away from the One who gave us everything is not a small thing.
Sahih Muslim 45a — Kitab al-Iman (The Book of Faith), hadith 45a
Anas ibn Malik reports that the Prophet (ﷺ) said that none of you truly believes until he loves for his brother what he loves for himself. The wording is "his brother", and the narrator adds that the Prophet (ﷺ) may have said "his neighbour" in its place.
Cited for
Islam's golden rule is only for Muslims. The report says "his brother", so everyone else is left out.
The response
The narrator was unsure whether the word was "brother" or "neighbour", so this report alone does not settle who is meant. The duty to all is in the Qur'an itself. It commands good to neighbours who are strangers (4:36), and justice even towards people one hates (5:8). It allows kind and just dealing with those who do not fight Muslims for their faith, for Allah (﷾) loves those who are just (60:8).
Where it lands — The Qur'an itself commands good to neighbours who are strangers and justice to all. It allows kind dealing with peaceful people of other faiths (4:36; 5:8; 60:8).
Analects 4.16 — Book 4, chapter 16
“The Master said, 'The mind of the superior man is conversant with righteousness; the mind of the mean man is conversant with gain.'”
Cited for
Islam is good for the sake of Paradise. Confucius's superior man is good for righteousness alone, which is purer.
The response
Islam agrees that good done for gain is worth little. The Qur'an praises those who feed the needy. They say, "We feed you for the sake of Allah alone: no reward do we desire from you, nor thanks" (76:9). Ihsan is to worship Allah (﷾) as if you see Him (Muslim 8). The aim is God Himself, not a trader's profit.
Where it lands — Both reject goodness for gain. Islam says to whom sincerity is owed.
Analects 16.8 — Book 16, chapter 8
“There are three things of which the superior man stands in awe. He stands in awe of the ordinances of Heaven. He stands in awe of great men. He stands in awe of the words of sages.”
Cited for
Confucius already taught awe of Heaven. A Confucian has what Islam asks for.
The response
Reverence is shared ground. Where Islam differs is in whom it reveres and how: Allah (﷾) alone, in the worship He prescribed, with nothing else served beside Him (4:36; 2:177).
Where it lands — Awe is common to both. Islam says to whom worship is owed, and how it is shown.
Perspectives
Confucian: a person of character
Confucius taught love of others, the rule of reciprocity, and a character moved by righteousness and by awe of Heaven. A Confucian may say that a person who lives this way is already what a good person should be.
Ren is to love all men (12.22), and one word, reciprocity, can guide all of life (15.23). A person who lives by it needs nothing more.
Rebuttal
Granted: this is real goodness. Islam commands justice to all and good to neighbours who are strangers (5:8; 4:36). But a rule between people does not say what we owe the One who made us. The Qur'an's verse on kindness begins there: "Serve Allah, and join not any partners with Him" (4:36).
The person of character is moved by righteousness, not by gain (4.16). So goodness is its own reward.
Rebuttal
Islam agrees that good done for gain is worth little. The Qur'an praises those who feed the needy. They say, "We feed you for the sake of Allah alone: no reward do we desire from you, nor thanks" (76:9). Seeking God's (﷾) pleasure is not a trader's gain. It is sincerity to the One who made us.
The person of character stands in awe of the ordinances of Heaven (16.8). So Confucian goodness already includes reverence.
Rebuttal
Granted: reverence is part of goodness. Islam teaches that Allah (﷾), who made us, has spoken through His messengers and told us what He asks (42:51). It also teaches how that reverence is shown: in worship as He prescribed it, with nothing served beside Him (4:36; 39:2; 2:177).
Injury is repaid with justice and kindness with kindness (14.36). That is a fair rule for good people.
Rebuttal
Islam also permits an equal recompense, and it praises forgiveness (42:40). It teaches to repel evil with what is better (41:34). Neither rule alone says to whom we answer for how we treat others. Islam says every soul returns to Allah (21:35).
A good heart is what counts
Many people, religious or not, hold that what matters is to be kind and fair. Some add that no belief about God is needed at all. Others say that God accepts every good person, whatever he believes.
Kindness is enough. A rule such as Confucius's reciprocity (15.23) needs no belief in God behind it.
Rebuttal
Islam agrees that kindness is a duty and commands it (4:36). The open question is not why you are kind, but what makes kindness binding rather than a preference. Islam answers that the One who made us set right and wrong, and every soul returns to Him (21:35).
Like Confucius's person of character (4.16), I am kind because it is right, not because anyone is watching. Goodness needs no more reason than that.
Rebuttal
Islam agrees that right and wrong are real. But "it is right" needs a ground: what makes it binding on everyone, and not just a feeling we share? Islam says right binds us because the One who made us set it. He is never unjust to any good done (4:40).
Allah is never unjust (4:40). So good people of every faith, or none, must be accepted by Him, whatever they believe.
Rebuttal
Islam agrees that Allah (﷾) is never unjust (4:40), and it does not say that people of other faiths, or of none, cannot do good. It does say that no religion other than Islam will be accepted (3:85). Wrath comes only after a messenger has come (17:15), and no Muslim may declare any particular person's fate.
The Islamic perspective
Islam commands justice to all and kindness to neighbours and strangers, asks for ihsan, and says exactly what goodness alone leaves out. It is a whole way of life, and it invites you to test the Qur'an.
The Qur'an commands good to parents, kin, the needy and neighbours who are strangers. It permits kind and just dealing with those who do not fight Muslims for their faith.
The Prophet (ﷺ) said that none truly believes until he loves for his brother what he loves for himself. The narrator was unsure whether he said "brother" or "neighbour".
Good character stands high in Islam. The Qur'an speaks of the Prophet's (ﷺ) exalted standard of character, and he said that among the best of you are those with the best character.
The Prophet (ﷺ) defined ihsan as worshipping Allah (﷾) as if you see Him, knowing that He sees you.
Righteousness is belief, worship, giving and good conduct together, offered with sincere devotion to Allah (﷾).
Good deeds count in the Hereafter together with faith.
Belief in God (﷾) and His messenger is asked once the message has reached a person. Allah (﷾) sends no wrath until a messenger has come.
Muslims do not ask forgiveness for those who died outside Islam. Yet no Muslim may declare any particular person's fate. It belongs to Allah (﷾), who is never unjust.
Islam is a whole way of life, and the Qur'an invites the doubter to test it.