Why do websites exclude CISG in Terms of Service? Why is this law
important?
A ToS that contains this term almost certainly also contains a term that states that the law of a particular jurisdiction (e.g. California) governs the legal rights of people who deal with the website.
The CISG is an international treaty that supersedes domestic law in international transactions that was adopted to overcome ambiguities that arise when people enter into an international sale of goods transaction without agreeing on whose law applies to the transaction.
This can also be a problem when one country may say that a contract with a choice of law provision has been agreed to, while another may say that a contract with a choice of law provision is not yet agreed to and binding. One of the many issues addressed in the CISG is how to determine when parties from two different countries have a binding agreement and what terms are included in that agreement.
Since the international treaty is arguably part of the law of the particular jurisdiction specified, it is important to exclude the CISG from the ToS, so that there is no lack of clarity regarding what the choice of law clause in the ToS means.
In other words, it is there to say that the ToS is governed by, for example, the California law that applies between two Californians, and not by the treaty that would applies in California to a transaction between a Californian and someone in another country in the absence of a binding choice of law agreement to the contrary.
As discussed below, the CISG expressly allows parties to contractually opt out of the CISG, but in most jurisdictions the reverse is not possible. Domestic parties can't opt out of purely domestic law governing the formation of contracts with each other. So, if the website wants to have one consistent set of rules that applies to everyone who deals with it, it needs to opt out of the CISG, rather than opting in the CISG and opting out of domestic law (which it is not allowed to do).
Why does it govern goods but not services (which seems to be the
reason of exclusion in ToS)? If it doesn't apply to services by
nature, do websites need to explicitly point out inapplicability in
their ToS?
The fact that the CISG applies to goods and not services is not the reason for its exclusion in the ToS of a website that currently provides only services.
The drafter of the ToS is concerned that the services it provides could be considered goods if they have some tangible component (e.g. if an instruction manual is mailed out or the services are delivered in a flash drive), and to be extra sure is excluding this law which could interfere with the choice of law clause, even though it is probably a non-issue because the website is probably not providing goods.
Perhaps, as another answer notes, because this may be boilerplate language used for a variety of websites.
Also, this language may be included in the ToS to cover the possibility that the website might be used to sell goods in the future without changing the ToS.
The CISG applies to goods rather than goods and services, because sales of goods are thought to be a simple and well defined subset of contract law which is unlikely to have unexpected consequences, while a law that applies to goods and services involves a far more diverse array of possible arrangements which could have unexpected consequences.
If the CISG applied to services, it could end up superseding a large swath of domestic contract law in unanticipated ways. For example, people were worried that the CISG might apply to construction contracts with foreign contractors if it were applied to both goods and services.
Why do websites have the right to make this specific law inapplicable,
but not the right to make criminal law inapplicable?
In general, we allow parties to contracts to choose which jurisdiction's law applies to their agreement since it is often unclear which law applies otherwise, and any jurisdiction with a connection to the contract or the contracting parties is likely to be legitimate.
Clarity of the rules of the road is especially important in contract law because it governs millions of transactions that will never be litigated in court. So the ability of people to determine their rights and comply with the law prior to a court adjudication is important.
Also, while the parties can choose which jurisdiction's laws applies, they cannot opt out of non-waiveable public policy exceptions to contract law (something which Article 4a of the CISG acknowledges).
This specific law may be opted out of because it is really a choice of law provision in disguise and not actually a joint decision to disavow the obligation to follow the law.
In the United States, domestic sales of goods are governed by the Uniform Commercial Code and international sales of goods are governed by the CISG. In countries with civil codes, domestic sales of gods are usually governed by the Civil Code and international sales of goods are governed by the CISG. So, this clause isn't saying that the sales of goods though the website aren't subject to any laws, just that they are governed by the UCC rather than the CISG, so as to avoid confusion about which of two possibly applicable laws applies.
Also, Article 6 of the CISG specifically permits contracting parties to opt out of it:
The parties may exclude the application of this Convention or, subject
to article 12, derogate from or vary the effect of any of its
provisions.
The CISG contains Article 6 for the reasons described above regarding clarity in choice of law clauses.
Criminal laws, in contrast, don't generally have statutory language that allows people affected by criminal laws to opt out of those laws.