TV Show or Movie Plot?

Hi all, I’m trying to figure out a movie or tv show.

All I can remember is a character dies, but is smiling. The main character can’t understand why they were smiling before death.

I thought it was the anime To Your Eternity but I don’t think it is. I was watching an episode and it reminded me of this.

Thanks