I understand that they are contractions of "Japanese" and "Nipponese". Why are they deemed offensive?
"Krauts" and "Ruskies" are others, but I don't think Germans or Russians would take much offence to those words (perhaps I'm wrong).
These are ethnic slurs. At their most benign, they are marginalizing and demeaning. At worst, they are extremely derogatory.
There is some indication that prior to WWII in the US, the term "Jap" was used as inoffensively as we might say "Brit" today, however this term was not used by the Japanese themselves. One example that gets cited a lot was "Jap Road," in Texas, so named to "honor" a Japanese farmer in the area. (It has now been renamed.) Put in context with the general increase in anti-Japanese sentiment in the US in the early 1900s (leading up federal legislation limiting their immigration in 1924), the word became a convenient epithet which encompassed all the negative feelings surrounding the Japanese people.
"Kraut" derives from sauerkraut (pickled cabbage) in German cuisine. Kraut was used to describe things and people of German origin from the 1800s, but acquired its particularly negative connotations during WWI, when it was used specifically to refer to German soldiers. (Propaganda favored the image of the barbaric "hun" to describe the German threat in general.) By WWII, anti-German sentiment was so strong that Americans attempted to banish anything "Kraut" or "German" from their vocabulary, except in reference to the enemy. Because it was such a staple in military rations, they started referring to sauerkraut as "liberty cabbage." "Kraut" became synonymous with "Nazi."
During WWII, "Jap" and "Nip" were used extensively in war slogans and in racist propaganda in the US with a specific aim of generating hatred and anger towards the Japanese people as a whole. Anti-Japanese sentiment continued for a long time after the war, and "Jap" remained both as a racial slur and as a slang word for a dishonorable attack/attacker. In the 1980s-90s, competition in automative/technology fields rekindled racial tension. "Jap" in the sense of Japanese-made products, carried the connotation of things being cheaply or shoddily constructed (ex: jap made cars, "jap crap").
German and Japanese diplomats have made it quite clear in recent years that they find these terms offensive.
"Russki" (and Roosky, Ruski, Rusky) is sort of the English form of the Russian word meaning, "Russian," but we spell, conjugate, and pronounce it differently than the Russians do themselves. It's in the Oxford Dictionary of Slang as being in use from 1858. In the US, the word is most commonly associated with Soviets during the Cold War, and so it carries the undertone of the enemy/opponent. It is not a completely neutral term, and has certainly been employed as a pejorative.
The The New Patridge Dictionary of Slang and Unconventional English is very good for this sort of thing. The concise versions are also good, but provide less context.