When I was a kid, about 8 to 11 years old, I saw this anime about a teenage boy that can transform his arm into a giant cannon. There's this antagonist that eats a whole human from that anime and he also stole their abilities after eating them. The antagonist can also transform his arm into a cannon but much bigger than the main character.
The anime you are thinking about is The Law of Ueki.
The Giant Cannon is "KUROGANE" (Sorry it's still so cool to say it), his Sacred Treasure.
His power is basically to turn Garbage into Trees. You might remember his Cannon being Tree-ish from the bottom.
The antagonist (Hanon), eats humans and keeps them inside his body and absorbs their powers.
This sounds a bit like Trigun, which was aired in the US on Cartoon Network in the early 2000's on Adult Swim. I don't remember the specific age of the protagonist, but he portrayed himself very childishly to keep other people off guard. In the final(?) episode, he fights with his brother, and they can both turn their arms into organic guns.
And, as luck may have it, Funimation (who own the distribution rights in the US) has put the entire series (in Japanese) up on youtube! Here's a clip of the protagonist (in red) getting his arm turned into a gun: