My answer supposes that religion is a nature of human beings. How i define religion is by a broad definition which can include Christianity, communism and even atheism.
If we are inherently and naturally religious, then salvation is a common desire.
If we take Christianity as a literal and basic example for religion, then the guilt is the fear that arises due to committing a sin.
Now , how this can be generally applied to include any other non literal forms of religion (Ex: communism): The question here is, from where is the superego (ego-ideal) being fueled ? In the example of Christianity,the answer is religious believes. But In-case of consumerism, the superego is being supplied by the culture. In rare cases , the superego might be personal, which results in a behavior which is not welcomed by the culture, for example: a maniac that does not suffer guilt after killing. (because killing is not forbidden in his superego)
What i am trying to say, is that guilt is a result of a receiving a low self-esteem, which happens , when one's self-image collides with his ego-ideal.
Why does guilty feel come in humans when they know they done
the mistake unknowingly . Because people don't feel guilty
when they commit mistake knowingly.
There could be two reasons why people do not feel guilty when committing mistakes knowingly:
-Their ego defense mechanisms suppressed the guilt.
-Their superego does not consider it a mistake or a sin. (as the above example)