Euron Greyjoy was one of the worst characters in Game of Thrones season 7 & 8, but one reason for that is because the Night King stole some of his storylines and motivations from George R.R. Martin's A Song of Ice and Fire books. Across the final two seasons of Game of Thrones, the Night King does things similar to Euron from the books, while the Greyjoy himself only really takes on the name, but just how much of Euron was transferred to the Night King?
The Night King emerged as one of Game of Thrones' main villains after his proper introduction in season 5's "Hardhome" (after previously making a brief appearance in season 4's "Oathkeeper"), while Euron served as something of a tertiary and then secondary antagonist. Neither character received a great deal of development, but it was the Night King who was established as the major threat, given he could raise and control the dead. Euron was a skilled pirate, but it's hard to compare to necromancy.
In season 7's "Beyond The Wall", the Night King made his biggest move yet, killing one of Daenerys' dragons and resurrecting it that same episode. Later in the season and again in season 8, he was shown to have complete control over Viserion. That was the first sign that Game of Thrones was borrowing from the books for the Night King, a character who doesn't exist in Martin's novels. Instead, this is similar to something Euron himself plans: he's sent his brother Victarion to win him Daenerys' hand in marriage, and along for the ride is dragonbinder, a magical horn that will supposedly bind a dragon to the will of the horn's master. Euron doesn't just want the Mother of Dragons, but one of her children too.
Game of Thrones season 8 had its own nod towards this when Euron was able to kill a dragon, but it's not quite the same as controlling one. As for how the Night King used the dragon, that too links to Euron's grand plot in the books. In the season 7 finale, "The Dragon and the Wolf", the Night King has Viserion burn down the Wall, allowing the army of the dead to walk through. In A Song of Ice and Fire, Euron's story is taking him close to Oldtown, where the Horn of Joramun a.k.a. the Horn of Winter is likely located in the possession of Samwell Tarly. It's believed that blowing the horn will bring the Wall down, and if Euron can get his hands on it then he'll absolutely be trying to do exactly that.
So why does Euron want a dragon, and why would he want to bring down the Wall? Well, Euron has been shown to be pretty mad, but he's also cunning, evil, and very deep into dark sorcery. "The Forsaken", a preview chapter of The Winds of Winter from the point-of-view of Euron's brother Aeron, lends credence to the theory that what Euron desires most is to bring about the apocalypse, allowing him to rise again as a (Drowned) God (h/t to PoorQuentyn's eldritch apocalypse posts on this).
That means Euron desires the destruction of Westeros, and wants a dragon and to bring the Wall down - allowing the Others to devastate the Seven Kingdoms - in order to achieve it. The Euron in Game of Thrones simply wants to have sex with the Queen, which is a rather drastic difference, but while his character is nothing like the Crow's Eye of the books, all of those objectives fit with the Night King's plan in Game of Thrones season 8. It's there we learn that he wants to kill Bran Stark in order to rid Westeros of its memory, so there'll be naught but death.
As a final element, the Night King has a storied history with the Three-Eyed Raven, who before Bran was Bloodraven. In the books, it's been hinted that Euron himself has a connection to Bloodraven - the Three-Eyed Crow in the books - either as a failed apprentice or perhaps even working for him still. It could be from this that the Game of Thrones showrunners took the Night King's own motivations. Although a lot of this depends on where GRRM takes The Winds of Winter and A Dream of Spring, it's already pretty clear that Game of Thrones' Night King stole a lot of Euron's book story.