We can see the answer in what happens immediately after.
It's textbook Ramsay manipulation, and it nearly worked.
Ramsay was surrounded by loyalists to Jon's faction who immediately aimed at him.
If he'd shot Jon, his men would have fired immediately without hesitation, killing him before rushing to try to save Jon.
But Jon, their leader, is still alive, and Ramsay's talking, not posing an immediate physical threat -
so they wait for Jon's order.
This gives Ramsay an opportunity to do what he does best: manipulate honourable fools, and exploit emotional weaknesses.
He challenges Jon to a one-to-one fight, a challenge no sane person would ever accept in these circumstances - but Jon is easy to manipulate and enraged from just having seen a big friendly giant get shot in the eye.
Jon charges, seemingly accepting the duel.
Jon's men don't know what to do.
This is duel,
right?
You don't interfere with duels.
If Ramsay had succeeded in shooting Jon here, Ramsay would get another opportunity to manipulate.
He could confuse Jon's men's sense of honour using the fact they'd seen him beat Jon in a one-on-one duel that Jon had seemingly accepted.
And a subtle detail: to my eye Ramsay seemed to be aiming at Jon's sword arm shoulder:
had he hit, he could even make a show of being merciful to a disablingly wounded Jon, putting himself in a good negotiating position.
Could it work?
Could he talk his way into exile, or possibly even divide what remains of Jon's ramsharkle army and turn the factions against each other (Wildlings and Night's Watchmen, Northerners and Vale knights)?
Maybe, maybe not - ill-disciplined leaderless men are unpredictable.
But he'd have better odds this way than if he'd simply shot Jon then been immediately felled by a hail of arrows (and possibly, ripped in half by an angry wounded giant).
movies.stackexchange.com/users/9718/user56reinstatemonica8
On top of the sadistic nature people have mentioned already, Ramsay is a pretty good strategist.
He was probably thinking "If I kill Jon, it's me vs. a Giant and the men.
If I kill the Giant, Jon can be goaded to fight me one on one, which is the only way I can win here."
He had just seen Jon come running across a battlefield into range of his archers because he goaded him to try to save his brother, so he thinks he knows what Jon will do next.
movies.stackexchange.com/users/36761/The Serpent Says
Ramsay enjoys teasing people.
The show runners revealed that it wasn't until the moment his dogs were about to eat him alive that Ramsay realized that he had lost (an evidence for this was his cocky comment that he "still held Winterfell" even though his entire army had been swipe out by the Knight's of the Vale cavalry
and he had not one but two Starks knocking at his doorstep.
When he saw Jon looking at Wun Wun in a "gratitude, prideful" way, he resolved into killing the Giant because he figured it would cause Jon to react erratically (just like he did when he literally blew up his well-thought battle plan for trying to rescue his dead-man-walking brother Rickon).
The only difference this time around was that Ramsay stood no chance against his enemies, but he hadn't realized that.
His twisted, messed up mind did not allow him to process the thought that he had lost the battle and that he was about to die.
movies.stackexchange.com/users/37041/Oscar Valdez Esquea
What can he achieve by striking Jon?
He might have missed it or killed him.
But he will surely going to be killed later on by the giant or by any random Wilding and soldier.
So not much gain.
He did the same with Rickon Stark in the same episode, he could have tried killed Jon , as he was on same distance as Rickon when he got killed.
Ramsay even tried to kill Jon Snow too after Wun Wun
but he got the shield on right time.
What he achieved by killing Wun Wun first?
Ramsay was same sadistic jerk and even near his deathbed he love playing with other people's emotion.
Trying to kill Jon Snow was no fun to him but giving him more pain was.
So he chose to kill Wun Wun first.
movies.stackexchange.com/users/1190/Ankit Sharma
I think that Ramsay got cocky...
He had a bow and arrows, and Jon Snow was a bit of a ways off.
He loves to mess with people and hurt them by hurting others, so he probably thought, "I'll kill Wun Wun just to make Jon angry, then I'll shoot Jon."
But as we know... Jon grabbed a shield and made his way over to Ramsay and beat his face in.
So that plan didn't work out too well.
movies.stackexchange.com/users/30884/Hunter Turner
It's Ramsay's way of torturing, he thought that if he kills the giant first, he'll hurt Jon's feelings, especially that Jon was already looking to the Giant and thanking him for everything.
All what Ramsay was doing is teasing Jon, first by the letter in the beginning of the season, then killing Rickon, then killing the giant.
Also, I believe that Ramsay knew he was dead anyways, so he wanted to hurt Jon as much as possible before Jon kills him!
movies.stackexchange.com/users/19724/Mostafa Elgayar
In  Game Of Thrones S06E09 , after the battle, inside Winterfell, the giant is on his knees and Jon Snow is standing besides him when Ramsay strikes the giant in the eye with an arrow. The giant was already fatally wounded and was unlikely to get back on his feet. Why did Ramsay aim for the giant then and not Jon Snow?
Why did Ramsay strike him?
movies.stackexchange.com
<character><game-of-thrones>
movies.stackexchange.com/questions/55814
movies.stackexchange.com/users/36788/AlwaysALearner
Ramsay killed the giant instead of Jon as a way of torturing Jon. Maybe Ramsay knew Jon was going to kill him, and wanted to torture him as much as possible before it happened All Ramsay was doing was teasing Jon, first with the letter at the start of the season, then with the murders of Rickon and the giant.
It's Ramsay's way of torturing Jon; he reasoned that if he kills the giant first, he'll hurt Jon's feelings, especially since Jon was already thanking the Giant for everything. All Ramsay was doing was teasing Jon, first with the letter at the start of the season, then with the murders of Rickon and the giant.