Our cat did this when the neighborhood stray decided the porch was his territory. It took a while, but we got him to move on. In the mean time we blocked our cat's view of him.
Get the outdoor cat away from the house.
We had a male and female (both neutered/spayed) and a neighbor cat used to come sit on the porch and our female would sit looking at him. The shrieks of anguish from our male were heartrending.
They go behind the blinds. Also, my house has many floor to ceiling windows and closing everything up more than I already do is not an accommodation I am willing to make for them.
I have 2 cats which I adopted in October. they are about 2 yrs old and 3 yrs old, come from the same family group, and have pretty much always behaved affectionately towards each other, like a bonded pair.
Recently, a neighborhood cat has been coming to our house, sits outside our window, and peers inside at them. (This has happened twice so far that I am aware of.). This other cat is an indoor/outdoor cat or outdoor only cat, I don’t know. My cats are kept indoors only. This other cat just sits and looks inside while my cats have complete freak outs inside- howling, hissing, puffing their tails out- all that. The outdoor cat just sits there, completely unperturbed and unmoving until I scare it away, which takes some effort.
Afterwards, my cats turn on each other and howl, hiss, and fight with each other like they hate each other or they think the other is an intruder. They are completely triggered. Now going on second day of this behavior.