Why is the freezer compartment in a refrigerator at the top?

Because in the freezer cold air present , cold air denser so it flows down to the rest of the compartment and thus cooling rest of the compartment