.com was originally used for US commercial websites but due to the international natures of many businesses it's become the standard extension for any commercial organisation. (Note that .com is not a 'restricted' extension. i.e. although it was intended for commercial organisations, there's no rule that says that other organisations or individuals can't use it).
In the early days of the internet, most users were in the US and the plan was that all users outside the US should have national extensions. (e.g. .fr for France, .au for Australia, etc. An exception was .co.uk for the United Kingdom).
With great competition to register some .com domain names, an additional international extension, .net, was added.
.org (either on its own or as part of .org.uk) was always intended for use solely by by non-profit bodies but, once again, the use of .org extensions is not formally restricted so some commercial organisations use this extension.
Some extensions are restricted. These include .gov which, on its own or as part of something like .gov.uk, must only be used for government websites. ('Government' includes local government. e.g. your local council probably uses .gov.uk).
Another restricted extension is .ac (which is usually encountered as part of .ac.uk). This is restricted to academic institutions (I believe that .edu is also restricted). Similarly, .plc can only be used by public limited companies.
In recent years, additional extensions have become available, including .info, .tv, and .biz. These are all unrestricted extensions.
There's a great deal more detail here:
http://en.wikipedia.org/wiki/Domain_name
Chris