According to the United Kingdom government, the first trademark legislation was in the late nineteen century. In the United States, the first federal trademark legislation was enacted in 1870.
The trademark act, or "Lanham Act", 18 USC Sec. 1051 etc. , is meant to allow consumers to correctly identify the sources of goods or services.
For example, when we buy a pair of Nike shoes, we want to know that Nike made them and they are of the quality and come with the guarantees that Nike, as a company, offers consumers. Trademark law allows Nike to stop other companies who might make cheap shoes and copy the Nike logo on it from doing so. Allowing a third party to use the Nike mark on its products, would (a) allow it to easily sell products by taking advantage of the money which Nike has spent on advertising, brand development, warranties and customer service, and other techniques to develop goodwill and loyal customers; (b) allow it to offer its products at lower cost than Nike due to lower overhead; and (c) injure Nike because the consumer will associate bad performance of the products with Nike or will try to return products never sold by Nike to Nike and will be angered if Nike refuses to take such products back.
When considering if there is "trademark infringement", the main question a court considers is whether the average consumer would be confused as to the source of the good or service.
A trademark is either a word, phrase, symbol or design, or combination of words, phrases, symbols or designs, which identifies and distinguishes the source of particular goods or services. A service mark is the same as a trademark except that it identifies and distinguishes the source of a service rather than a product.
Normally, a mark for goods appears on the product or on its packaging, while a service mark appears in advertising for the services. A "tm" on a product indicates unregistered trademark rights and an "®" indicates a registered mark. It is illegal to place an "®" on a mark that does not have national registration.
Marks fall into several categories: arbitrary or fanciful, suggestive, or descriptive.
Trademarks are generally not granted in generic words, phrases, symbols or designs; immoral or scandalous words, phrases, symbols or designs; false, misleading or mis-descriptive words, phrases, symbols or designs; or surnames.