His father decided to name the boy after the Argentina international because he is a huge fan of the footballer and reigning La Liga champions FC Barcelona.
ISIS demanded a ransom for the release of the boy and his mother and sister as they were held hostage, and ordered the family to change the boy's name.
Iraqi News reported that the boy, now aged five, and his mother and sister were later rescued and are now with his father at a refugee camp in Dohuk, in Iraqi Kurdistan.
The trio was abducted when ISIS invaded Sinjar, Iraq, which is occupied mostly by Yazidis.
The boy's father told Kurdistan 24 that ISIS deemed Messi to be an "infidel" name.
His mother said the terror group demanded a ransom for their release, but the family was broke.
She said the terrorists ordered her to change the boy's name to the Muslim name of Hassan.
The boy, who wasn't named by Iraqi media, was left traumatised after spending two years in captivity, and now plays with a toy gun more often than a football, Iraqi News reported.
He doesn't speak very often, nods disapprovingly when people call him Messi and is afraid of his captors.