It's an offense, a mockery for someone. The origin is in the titulus placed on the Cross where Jesus died, which according to the Gospel of John had the Latin inscription INRI, by Iesus Nazarenus Rex Iudaeorum ( "Jesus, Nazarene King of the Jews"). The reason was the custom of identifying the executed foreigners, but tradition says that naming Jesus of Nazareth as "King of the Jews" (which was his crime) was a mockery of exposing him crucified. And from there comes the meaning that is given to it in Spanish.