Why didn’t Loki stab Thanos before giving her the Thanos Space Stone?
Loki did it in a final, desperate move.
As the Statesman came under attack by Thanos, no one was prepared for the Power Stone, one of the six most potent objects in the Universe, to be in his possession. The Asgardians fought back, but their efforts proved futile. Thor and Heimdall suffered severe injuries, and many soldiers lost their lives.
Loki, however, was the only one on board who knew why Thanos and his Black Order had come. He had kept his secret of what he had taken from Asgard to himself.
Let’s go back in time, shall we?
After falling into the black hole in Thor 1, Loki was presumed dead. However, it was later revealed that he survived and had encountered the Mad Titan, Thanos. Loki knew of Thanos’ plan to collect the Infinity Stones and how powerful he was.
Now, six years later, Thanos and Loki meet again, and the latter attempts a final, last-minute plan to repel him. Loki hides the Hulk and orders him to attack when he signals, expecting the Hulk to win. However, Thanos effortlessly defeats the Hulk, knocking him unconscious, which had never happened before.
Loki’s last resort was to try and kill Thanos by stabbing him with a blade made of Uru, the same material that could destroy Captain America’s Vibranium shield and penetrate Thanos’ skin. However, he fails and dies, a noble yet foolish attempt to stop the “psychopathic” (in Peter Quill’s words) villain.
It is worth noting that Loki caught an arrow from Hawkeye without even looking, and his speed would have allowed him to succeed had Thanos not had the Space Stone.
In conclusion, Loki attempted to kill Thanos because he had already tried everything he could to stop him, and none of it had worked. His final, desperate move was similar to his father’s attempt to kill Odin, but just like his father, Loki’s plan ultimately failed.