Historical linguists who specialize in Japanese agree that it is one of the two members of the Japonic language family, but do not agree further about the origins of the language. An older view, still widely held by non-specialists, is that Japanese is a language isolate.
As for its relation to other languages, there are several competing theories (presented roughly in descending order of likelihood):
Japanese is a relative of extinct languages spoken by historic cultures in what are now the Korean peninsula and Manchuria. The best attested of these is the language of Goguryeo (a.k.a. Koguryo), with the more poorly-attested languages of Baekje (a.k.a. Paekche) and Buyeo (a.k.a Puyo) hypothesized to also be related. The limited data on these languages, as well as these cultures' historic ties, are the primary evidence.
Japanese is a relative of other Asian languages. This theory maintains that Japanese is related to other East Asian languages such as Korean (and possibly the Sino-Tibetan languages).
Japanese is a relative of the Altaic language family. Other languages in this group include Mongolian, Tungusic, Turkish, and sometimes, Korean. Evidence for this theory lies in the fact that like Turkish and Korean, Japanese is an agglutinative language. Japanese also has (phonologically distinctive) pitch (called pitch accent in linguistics), similar to Serbian/Croatian. Additionally, there are a suggestive number of apparently regular correspondences in basic vocabulary, such as ishi "stone" to Turkic daş, yo "four" to Turkic dört.
Phonological and lexical similarities to Austronesian languages have been noted.
Japanese is a kind of creole, with an Altaic substratum and an Austronesian superstratum, or vice versa. It has an Altaic grammatical substructure, and core Austronesian vocabulary.
Japanese is related to southern Asian languages. Ono Susumu has suggested a possible relationship between Japanese and Tamil, a member of the Dravidian language family spoken in southern India.
Specialists in Japanese historical linguistics all agree that Japanese is related to the Ryukyuan languages (including Okinawan); together, Japanese and Ryukyuan are grouped in the Japonic languages. Among these specialists, the possibility of a genetic relation to Goguryeo has the most evidence; relationship to Korean is considered plausible but is still up to debate; the Altaic hypothesis has somewhat less currency. Almost all specialists reject the idea that Japanese could be related to Austronesian/Malayo-Polynesian languages or Sino-Tibetan languages, and the idea that Japanese could be related to Tamil is given no credence at all.
It should be noted that linguistic studies, like all fields, can be strongly affected by national politics and other non-academic factors. For example, some linguists would say that Dutch is a dialect of German but is known as a language for political reasons. Japan's long-standing rivalries and enmities with virtually all of its neighbours make the study of linguistic connection particularly fraught with such political tensions. However, these tensions are less prevalent among non-Japanese researchers.