The rules regarding airport transit in the Schengen area are detailed in Do I need a visa to transit (or layover) in the Schengen area? Briefly, Pakistani nationals do generally need an airport transit visa but you can transit without visa in Zurich thanks to your UK student visa.
If you want to leave the airport, you will require a regular type C Schengen visa. You will need to submit some documentation (bank statements, proof that you are a student, a copy of your passport, etc.), two photos, get a travel insurance policy and pay a EUR 60 fee (plus some service charge for the company handling applications). It's obviously a lot just to be able to see Zurich for a few hours but it should be doable in three weeks (this document says “up to 14 working days” for applicants from Pakistan). All details on the website of the Swiss Ministry for Foreign Affairs.
Since you asked for it, here is a detailed discussion of the source for all this. The airport transit visa requirement derives from article 3 of the Schengen Visa Code:
- Nationals of the third countries listed in Annex IV shall be required to hold an airport transit visa when passing through the international transit areas of airports situated on the territory of the Member States.
Pakistan is an annex IV country, which is why a visa is generally required. But the rest of the article defines a number of exceptions, in particular:
- The following categories of persons shall be exempt from the requirement to hold an airport transit visa provided for in paragraphs 1 and 2:
(c) third-country nationals holding a valid visa for a Member State which does not take part in the adoption of this Regulation, for a Member State which does not yet apply the provisions of the Schengen acquis in full, or for Canada, Japan or the United States of America, when travelling to the issuing country or to any other third country, or when, having used the visa, returning from the issuing country;
Together with Ireland, the UK is a “Member State which does not take part in the adoption of this Regulation”, i.e. an EU member state that is not part of the Schengen area. So holding a valid UK visa means you can do a sterile airside transit in Zurich and elsewhere in the Schengen area, no matter your citizenship.
This somewhat odd turn of phrase is a result of the peculiar status of the Schengen regulations and the whole former “third pillar” of the EU. The Schengen agreement was initially implemented in a separate convention before being integrated into EU law by the treaty of Amsterdam (specially as part of the third pillar, which meant the UK or Denmark could stay out and had a veto on its evolution). The treaty of Lisbon then abolished the notion of separate pillars and instead created an opt-out/opt-in mechanism for the UK, Ireland and Denmark…
Meanwhile, “Member State which does not yet apply the provisions of the Schengen acquis in full” means either Bulgaria, Romania, Cyprus or Croatia, which do not have a right to opt out from the regulation but are not yet part of the Schengen area for various unrelated reasons. Although it does have its own set of “opt-outs”, Denmark does as far as I know currently apply the full Schengen acquis.
So we are left with a set of EU regulations that do not apply to the whole EU because some EU member states still do not take part in some aspects of the area of freedom, security and justice while some non-EU countries do take part in the common visa policy. Fortunately, most of this is not relevant to your issue but it can get very ugly on a procedural level and explains why the rule is phrased in this rather obscure way.