Greeting is an expression of good wishes. At the gates of Paradise, believers will be greeted with the greeting of peace.
It is obligatory for a believer to return a greeting with a better greeting or a similar one:
When you are greeted with a greeting, return the greeting or improve on it. Allah takes account of everything. (Surat an-Nisa’; 86)
According to the mentality of ignorant people, not returning a greeting or pretending not to hear it is considered a mark of superiority. Underlying such conduct are wicked attitudes. In Islam, such an attitude is detested. Returning a greeting is a command of Allah for all believers.