The functions of executive and judiciary are based on the laws that are passed by the legislature.
In the past, the monarch was alone the executive, legislature and the judge. The legislature was born when, the monarch created the council/assembly consisting of knights, clergy, nobles, and commoners.
The council/assembly used to advise the King and eventually the body of advisors came to be the House of Commons and the assembly of nobles became the House of Lords.