The practice of the government team electing the Prime Minister is a convention Australia adopted from the British system of government, or the Westminster system. A convention is an unwritten rule which has been followed for a long time. Another convention in the Australian Parliament is that the Prime Minister is always a member of the House of Representatives, not a senator.
When Australia became a nation at the time of Federation the Australian Constitution, which is the set of rules by which Australia is run, took effect. While the role of Prime Minister may be seen as the most important person in Parliament, it is not mentioned in the Constitution. Instead tradition is that the Prime Minister is chosen by the party, or coalition of parties, with the support of the majority of members in the House of Representatives.