When lineouts take place in Rugby Union I have only ever seen Hookers being the player who takes the throw in. Is it in the laws of the game that only a Hooker is allowed to take the throw?
There is no law stipulating who has to take the line-out throws. To see why it is the Hooker’s job, we can consider a process of elimination of the other positions.
First, it should not be any of the backs, since they will be needed to execute backline plays (or defend against them) once the ball is cleared from the lineout.
Consider then the forwards. The two props are the heaviest and strongest players on the team. Their strength is best utilised for lifting the lineout jumpers, so they shouldn’t take the throws. The back rowers, flankers and number 8 are more nimble smaller players, suited to cleaning up loose balls that are not caught cleanly or quickly moving to support a player who has successfully caught the lineout throw. Someone has to be the jumper and obviously being tall helps. Since the back rowers need to be nimble, they are generally not overly tall. Therefore the second rowers (also called locks) are usually tall players able to be good lineout jumpers. Note that the Hooker needs to be shorter than the props in order to hang off them in the scrums, so they can’t be tall and therefore not suited to being jumpers.
So, by process of elimination we see that the most logical player left over to actually take the throw is the hooker. They are not needed in the backline and would be the least useful forward to participate in the lineout itself, so they instead learn the skill of taking the lineout throw.