There is no contradiction. A prophet foretold future events.
From Encylopedia Judaica: Samaria -
"Samaria (Heb. Shomron, modern Sebaste) is a city established as the capital of the northern kingdom of Israel during the reign of the Ephraimite ruler Omri c. 884 B.C.E. on a mountain ridge 12 miles northwest of Shechem on the central route from Jerusalem to Galilee. The territory controlled by the city was eventually named for it.
Prior to the Omride period the site appears to have been the center of an extensive wine and oil production area, which may have accounted for its choice as the new capital. Apparently the origin of the name of the site was from Shemer, the eponymous owner of the land that Omri purchased for two talents of silver (I Kings 16:23–24)." Source: here
The scriptures do not say "the city of Samaria", but "the towns of Samaria". The prophet was speaking of a future time in which the entire area formerly called Shemer would become known for the capital city of Samaria which was established for the northern ten tribes of Israel by Omri.
Jeroboam established alternate worship sites in Bethel and in Dan that were idolatrous "high places" where the people worshiped golden calves. See 1 Kings 12:28-30. The old prophet of 1 Kings 13:32 foretold the idolatry that would occur in Bethel and the other high places that would be established by the kings of Israel, but Jeroboam would not listen to the prophet of God.
1 Kings 13:33-24,
"After this thing Jeroboam hath not turned from his evil way, and turneth back, and maketh of the extremities of the people priests of high places; he who is desirous he consecrateth his hand, and he is of the priests of the high places.
34 And in this thing is the sin of the house of Jeroboam, even to cut [it] off, and to destroy [it] from off the face of the ground." (YLT)
Excerpt from Adam Clarke's commentary on vs. 32 & 33:
"Verse 32
In the cities of Samaria - It is most certain that Samaria, or as it is called in Hebrew Shomeron, was not built at this time. We are expressly told that Omri, king of Israel, founded this city on the hill which he bought for two talents of silver, from a person of the name of Shemer, after whom he called the city Samaria or Shomeron; (see 1 Kings 16:24;); and this was fifty years after the death of Jeroboam. How then could the old prophet speak of Samaria, not then in existence, unless he did it by the spirit of prophecy, calling things that are not as though they were; as the man of God called Josiah by name three hundred years before he was born? Some suppose that the historian adds these words because Samaria existed in his time, and he well knew that it did not exist in the time of the old prophet; for himself, in the sixteenth chapter, gives us the account of its foundation by Omri. After all, it is possible that God might have given this revelation to the old prophet; and thus by anticipation which is the language of prophecy, spoke of Samaria as then existing. This is the solution of Houbigant, and is thought sound by many good critics."
"Verse 33
Jeroboam returned not from his evil way - There is something exceedingly obstinate and perverse, as well as blinding and infatuating, in idolatry. The prediction lately delivered at Beth-el, and the miracles wrought in confirmation of it, were surely sufficient to have affected and alarmed any heart, not wholly and incorrigibly hardened; and yet they had no effect on Jeroboam!" Source: here
All bold emphasis is mine.