There is no requirement to forgive someone that does not petition for forgiveness. Nevertheless forgiving someone that has not requested it can be an expression of piety.
The Talmud (Megillah 28a) attributes Nehunya b. ha-Qana's longevity to his practice of forgiving all those that wronged him before going to sleep:
ולא עלתה על מטתי קללת חברי כי הא דמר זוטרא כי הוה סליק לפורייה אמר שרי
ליה לכל מאן דצערן
Rabbi Neḥunya also said: Nor did I ever allow the resentment caused by
my fellow’s curse to go up with me upon my bed. This is referring to
conduct such as that of Mar Zutra. When he would go to bed at night,
he would first say: I forgive anyone who has vexed me.
Within the context of discussing the misvah of rebuking one's fellow, where such rebuke would be of no avail, the Rambam in H. Deoth 6:9 states:
מי שחטא עליו חברו ולא רצה להוכיחו ולא לדבר לו כלום, מפני שהיה החוטא
הדיוט ביותר או שהייתה דעתו משובשת, ומחל לו בליבו, ולא שטמו ולא
הוכיחו--הרי זו מידת חסידות: לא הקפידה תורה, אלא על המשטמה.
It is pious behavior if a person who was wronged by a colleague would
rather not admonish him or mention the matter at all because the
person who wronged him was very boorish or because he was mentally
disturbed, [provided] he forgives him totally without bearing any
feelings of hate or admonishing him. The Torah is concerned only with
those who carry feelings of hate.
This does not mean that under all circumstances that it is pious to forgive others without their having requested of it.
The Talmud recounts (Yoma 87a) that R. Zera sought to give those that offended him the opportunity to repent and ask for forgiveness:
ר' זירא כי הוה ליה מילתא בהדי איניש הוה חליף ותני לקמיה וממציא ליה כי
היכי דניתי וניפוק ליה מדעתיה
It is related that when Rabbi Zeira had a complaint against a person
who insulted him, he would pace back and forth before him and present
himself, so that the person could come and appease him. Rabbi Zeira
made himself available so that it would be easy for the other person
to apologize to him.
In summary it appears that where there is no utility in rebuking the offender, then forgiving them is meritorious (though not mandatory), and where there is potential utility (i.e. the offender may repent of their ways), then withholding forgiveness is an appropriate tact.