“Major Toyama was killed in Tokyo in March 1945, in the line of duty,
during an air raid.” “I’m very sorry to hear that.” (Kafka on
the Shore, tr. by Philip Gabriel)
Logically, to hear precedes I’m very sorry in time, and so I’m very sorry to have heard that is more proper to me.
(1) Though we can say I’m very sorry to have heard that, can we also say I’m very sorry to hear that, because to-infinitival phrase’s tense can be conjectured in the context. (2) Or can we only say as the original, and is there some reason it has to be?
When you’re having a conversation, things are often considered to be happening "at the same time". Yes, technically you heard it in the past, but we’re talking about a few seconds in the past. Practically, you just heard it and are still absorbing the information (to hear = I hear your words, I am processing them, I’m still in a state of being surprised and sorry to hear this news.)
So the correct way to say this is definitely only "I’m very sorry to hear that." Hear doesn’t literally mean hear; you could respond this way to a chat message, an email, even a letter (where the words are read, not heard). When you’re sorry to hear something it means I now possess the knowledge that [x] happened, and as I speak/write this, I am still unpleasantly surprised by the events.
Even when you’re putting this into the past, you still use hear and not heard:
Jane: Did you hear about Anne?
Mark: Oh, yes. I was very sorry to hear she won’t be returning next year.
Am is shifted back to was to demonstrate the past tense, but hear remains the same. You wouldn’t say "I was very sorry to have heard."