Trotsky, as the leader of the Fourth International , was a direct competitor to Stalin as the Leader of the World Worker Movement.
Stalin needed all the communists to be subservient to him, especially during the World War. Squabbles between Stalinists and Trotskyists inside the Spanish Republicans cost them dearly and demonstrated that Trotsky was still a force to be reckoned with.
Don't forget that Stalin had a vengeful personality and wanted to kill Trotsky out of pure spite too.
history.stackexchange.com/users/1979/sds
Stalin was concerned about Stalin and the fate of the Marxist-Leninist-Stalinist world revolution.
The success of a Marxist-Leninist-Trotskyist movement would have endangered both his physical survival and his political legacy.
Clarification:
I see Stalin as a paranoid tyrant who did take power by force, and was afraid that others would do the same to him.
He reacted forcefully to potential rivals, and even more forcefully to actual rivals, which Trotsky was.
Trotsky provided a slightly different interpretation of Marxism-Leninism, which was a threat for Stalin who derived his legitimacy from claiming Lenin's heritage.
history.stackexchange.com/users/12036/o.m.
I think you need to reverse your question: why not kill him?
When the death sentence was passed on Bukharin, Stalin's long-neutralised and powerless former rival, Bukharin was allowed to write a short note to his sometime friend.
Koba, why do you need me to die?
Stalin did not answer these pathetic words.
Unlike Trotsky, it would have been no trouble at all for Stalin to keep Bukharin quietly under house arrest.
However, Bukharin had to die.
Although Trotsky had absolutely no prospect of overthrowing Stalin as leader of the USSR, he could have made it much harder to galvanise foreign communists, and get sympathy and support from Western governments.
But mainly, Trotsky had crossed him, so
Trotsky had to go.
history.stackexchange.com/users/8451/Ne Mo
First of all, Trotsky had contested the succession to Lenin with Stalin.
If Lenin had been in better health in his last days, Trotsky might have won because Lenin preferred him.
So Trotsky was an existential threat to Stalin in the Soviet Union.
The second thing was that Communism was supposed to be a worldwide movement, not just for the Soviet Union.
So Trotsky was challenging Stalin's leadership on a global basis, after having lost a succession battle with him in the Soviet Union.
Other than Trotsky's succeeding to Lenin, the last thing Stalin wanted was to have say, a Mexican Communist movement challenging the Soviet Communist movement for global supremacy.
history.stackexchange.com/users/120/Tom Au
Stalin had Trotsky assassinated for personal reasons.
These can be seen if you read
The Revolution Betrayed and Stalin by Trotsky, and Stalin:
A biography by Robert Service which sums up Trotsky's demise in 1940.
Trotsky attacked Stalin politically and personally through his books and while Lenin was alive.
Trotsky was mocking Stalin about his physical appearance, shortcomings, and his political incompetence.
This greatly offended Stalin which made him take action against Trotsky.
history.stackexchange.com/users/31362/user31362
Leon Trotsky was killed with a mountaineering ice axe in Mexico. The method of murder chosen was interesting. If he was a political fugitive in far off Mexico, why bother dealing with him? What about Trotsky's communist ideology differed from Stalin's and caused the perceived threat to the Soviet state?
Why did Stalin and the Soviet leadership have Leon Trotsky assassinated?
history.stackexchange.com
<soviet-union><stalin><assassination><trotskyism>
history.stackexchange.com/questions/38738
history.stackexchange.com/users/24937/Ed Kideys
Trotsky had a slightly different interpretation of Leninism and this was a threat to the legitimacy of Stalin. Trotsky had contested the succession of Stalin. He could have made it harder to galvanise foreign communists as he needed as communists to be subservient to him. Stalin had a vengeful personality and Trotsky had attacked him personally through his books. There are many reasons that Stalin had Trotsky killed, but the most important is probably that Stalin saw Trotsky as a threat to his leadership since he had so much influence within the Communist movement. Communism was intended to be a global movement, and Stalin saw Trotsky as a destabilising influence on world communism. Additionally, it should be remembered that Stalin had a vengeful personality and may have simply killed Trotsky in retaliation for personal attacks on him.
Even though he was outside of the Soviet Union, Trotsky had contested Stalin's leadership and still wielded enough influence to be a threat to Stalin at home. Stalin say Trotsky as a destabilising influence on the world Communism movement and needed all communists to be subservient to him. Stalin was petty and had Trotsky murdered for personal reasons, Trotsky having insulted him through his writings.