However, if fans are wondering how Shanks got the Gum Gum fruit, the answer can be found in the series' Wano arc. He stole it from the World Government, the global regime that rules the One Piece universe. Disclaimer: This article contains spoilers for the One Piece manga and anime.
Shanks stole the Gomu Gomu no Mi from a government ship, according to the revelation in episode 1040 of the anime and chapter 1017 of the manga. The intriguing aspect of this revelation is whether Shanks knows the secret behind the legendary devil fruit.
In short, Shanks didn't plan to steal this fruit on his own will, he stole the fruit because the Hito Hito no Mi; Model: Nika wanted him to. It was a divine intervention since this fruit carries the power of a God.
In One Piece 1045, Lucky Roo and Shanks' Lies and misguidance to Luffy about Gomu Gomu no Mi will be revealed. After hearing everything, the strong boy, Luffy starts thinking about him as a rubber man. But he is still unaware of the extreme power he could acquire with the Devil Fruits.
Gomu Gomu No Mi: Luffy ate the fruit around the 9th year since the prophecy. One year before shirahoshi's birth. That means that shanks was trying to CREATE the next joyboy (From the latest chapter it's obvious that shanks knew the truth behind the Gomu Gomu no mi).
In One Piece, Joy Boy is a mysterious figure who lived during the Void Century. He was first mentioned in the “Fish-Man Island Arc”, and his legacy transcends the boundaries of time.
Although there might be reasons to believe that Luffy might be Joy Boy, such as the former's entire appearance changing, it is important to clarify that it is not a case of reincarnation. Joy Boy lived around 900 years ago, during the mysterious Void Century, and hence there is almost no information on him.
Shanks is actually a deep undercover government agent. When he had the fruit, he was taking it back to the government before Luffy ate it. He didn't kill Luffy immediately because he liked him or some other anime reason, but at the end of the anime he gets betrayed.
The Gomu Gomu no Mi is a Paramecia-type Devil Fruit that grants the user's body the properties of rubber, effectively turning them into a Rubber Human (ゴム人間, Gomu Ningen?).
The Gomu Gomu no Mi which is also referred to as “Hito Hito Model: Nika” It is a Mythical Zoan-type Devil Fruit that enablhes the user's body to stretch, making the user a rubber Human (ゴム人間 Gomu Ningen).
If consumed by a human, this fruit will have no effect on them other than taking away their ability to swim. Oda said in a joking manner that a human who ate this fruit might become "more human-like" or find their "true spirit".
The Hito Hito no Mi, Model: Nika was first revealed to the fans in the very first chapter of the story. Luffy ate the fruit thinking it was dessert and gained the power of rubber ever since. The fruit was actually in possession of Shanks and according to his crew, they stole it from an enemy ship.
One Piece Confirms Shanks is a Celestial Dragon
This, together with a line from the movie in which the Five Elders say that Shanks belongs to the "Figarland Family", seems to confirm that Shanks is, in fact, a descendant of the Celestial Dragons, the all-powerful families who hold absolute authority over the world.
Nothing in the anime or manga confirms whether Shanks knew about Dragon being Luffy's father, because people came to know only after Garp's revelation and later when Sengoku revealed the same during the Marineford war. So maybe after the war Shanks could have come to know, but before that, I don't think so.
This chapter confirms what fans already suspected, that Shanks was aware of the Gomu Gomu no Mi secret. This would also explain why he put so much trust in Luffy, a kid from an unknown village in East Blue, to leave him with his most prized possession, the straw hat that belonged to the Pirate King, Gol D.
Despite its initial impression, Luffy's Devil Fruit is also a Zoan-type of the Mythical branch, the Hito Hito no Mi, Model: Nika. Luffy's appearance and abilities in awakened form (which he calls Gear Fifth), however, differ greatly from other awakened Zoans shown recently in the series.
More importantly, the fruit's real name was hidden by the Government to hide its significance. In a shocking turn of events, it was revealed that the Gomu Gomu no Mi is actually a Zoan type of Devil Fruit and its real name is the Hito Hito no Mi, Model: Nika.
One of the biggest advantages of the Gomu Gomu no Mi is that it makes Luffy immune to blunt attacks. Normal punches don't hurt Luffy, nor does any other blunt attack. His biggest weakness once upon a time was sharp attacks, however, now he's overcoming that weakness for the most part as well.
Luffy's Gum Gum Fruit is one of the strongest in the world of One Piece, but there are still some varieties that are stronger.
At one point, the Five Elders had an unexpected meeting with Shanks. They stated that the only reason he was granted a private audience with them was because of his status. Shanks expressed his gratitude to the Five Elders before discussing an unspecified “certain pirate” with them.
Shanks loses his arm because of a Sea King, despite being one of the strongest characters in the series.
His straw hat
The hat also symbolizes Luffy's promise to Shanks that he would return the hat once he became a great pirate.
Legacy. The original Joy Boy left messages regarding his return 800 years later. One of those messages was to Fish-Man Island and to Poseidon, apologizing for breaking their promise, and promising that someone would fulfill it in the future.
tl:drOne of the moons of OP is made of seastone/poneglyph material and some of it fell to earth. Celestial dragons came from that moon, Joy boy was one too.
With the Awakening of his Devil Fruit, Luffy has become the "Warrior of Liberation," taking up the mantle of Joyboy through unleashing his new power. Joy Boy has always been one of One Piece's most mysterious figures, and for the past 900 years, there has been very little evidence he even existed.