Ahaziah was forty-two years old when he became king, and he reigned one year in Jerusalem. And the name of his mother was Athaliah, the daughter of Omri.
2 Chronicles 22:2
Ahaziah was twenty-two years old when he became king, and he reigned one year in Jerusalem. And his mother’s name was Athaliah the granddaughter of Omri king of Israel. 2 Kings 8:26
This apparent contradiction can be explained simply:
Ahaziah was part of King Ahab's dynasty, which began with his grandfather Omri. The reigns in this family add up as follows:
In total, the dynasty had lasted 42 years when Ahaziah started his reign. Thus, 2 Kings 8:26 gives us Ahaziah’s actual age, while 2 Chronicles 22:2 refers to the age of his family’s rule.
and Jacob the father of Joseph the husband of Mary, of whom Jesus was born, who is called Christ.
Matthew 1:16
Now Jesus Himself began His ministry at about thirty years of age, being (as was supposed) the son of Joseph, the son of Heli.
Luke 3:23