The Prophet (sal Allahu alaihi wa sallam) said: “Allah has inspired to me that you are all to be humble towards each other such that no one transgresses against or exalts himself above another.” [Sahih Muslim]
Unfortunately, the tides have so turned, that we now consider it a mark of confidence to boast about ourselves. Whatever you have, is because Allah (subhana wa ta’ala) gave it to you or allowed you to have it; whether it is intelligence, looks, wealth, lineage, faith, character or anything else.
If someone thinks that they worked hard and achieved by their own merit alone what they got, they should look at all those who also work hard but do not reach their goals. If you studied hard and excelled, who made it possible for you to have the time to study? You could have been born into a family where children have to go to work to make ends meet.
If you excel in your business, who allowed you to accumulate the capital to begin it, or gave you the ideas for it, or prevented accidents from befalling it? Who gave you the health to work for your business and kept debilitating illness away from you?
If you pride yourself on your Islam, who put your ruh into a child being born to a Muslim couple? Had you been raised on some other religion would you have come to Islam on your own? Who has surrounded you with angels and allowed you to resist Shaitaan and not turn to Kufr?
Lineage or looks are even more obviously Allah given. Therefore, there is nothing at all for you to boast about.
Allah (subhana wa ta’ala) says, “Do not praise yourselves: He knows best who is godfearing.” [Al-Quran 53:32] The only thing worthy to boast about is taqwa. And Allah (subhana wa ta’ala) forbids boasting about that too. There are two reasons for this. One is that only Allah (subhana wa ta’ala) knows how good a person really is. And only His knowing matters. He (subhana wa ta’ala) is the one who will reward us for it.
The other reason we are not to boast is that it is contrary to taqwa. A person who has true awareness of Allah (taqwa) is painfully aware of their own shortcomings, their dependence on Allah (subhana wa ta’ala) and the many sins they commit knowingly and unknowingly. Therefore, a pious person is necessarily humble and modest and can never be a braggart.