The X-shaped scar on Monkey D. Luffy's chest was caused by Admiral Akainu during the Marineford War arc. While Jinbe was protecting Luffy by carrying his unconscious body away from the battlefield, Akainu pursued them relentlessly and struck with his magma powers. Akainu's magma fist pierced through Jinbe's chest and left a deep burn mark on Luffy's chest, resulting in the iconic X-shaped scar. This injury nearly killed Luffy, and he survived thanks to the intervention of allies like Crocodile, Buggy, and the Whitebeard Pirates
. There is a non-canon filler arc in the anime where Luffy's chest scar is shown as being caused by a sword attack from Zoro during a memory-loss scenario, but this is not considered part of the official storyline. The true, canonical origin of the scar is from Akainu's attack during the Marineford War
. In summary, Luffy's chest scar was given to him by Admiral Akainu during the Marineford War, inflicted while Jinbe was shielding him from the attack.