What is Legislation and how does it work?

Legislation (or “statutory law”) is law which has been promulgated (or “enacted”) by a legislature or other governing body, or the process of making it. (Another source of law is judge-made law or case law.) Before an item of legislation becomes law it may be known as a bill, and may be broadly referred to as “legislation” while it remains under consideration to distinguish it from other business. Legislation can have many purposes: to regulate, to authorize, to proscribe, to provide (funds), to sanction, to grant, to declare or to restrict.

Under the Westminster system, an item of primary legislation is known as an Act of Parliament after enactment.

Legislation is usually proposed by a member of the legislature (e.g. a member of Congress or Parliament), or by the executive, whereupon it is debated by members of the legislature and is often amended before passage. Most large legislatures enact only a small fraction of the bills proposed in a given session.
Whether a given bill will be proposed and enter into force is generally a matter of the legislative priorities of government.

Legislation is regarded as one of the three main functions of government, which are often distinguished under the doctrine of the separation of powers. Those who have the formal power to create legislation are known as legislators; a judicial branch of government will have the formal power to interpret legislation (see statutory interpretation); the executive branch of government can act only within the powers and limits set by the law. source: wikipedia