Baka does indeed mean stupid and is used to insult someone you are mad at, but it also has another use which is widely unreported.
The first and most common use is basically the same as it is used in English.
- Someone cuts you off in traffic.
- You go to the supermarket and forget your wallet.
The list goes on and on (not here it doesn't though).
However, a much more interesting use in Japan is as a term of endearment. Couples use it all the time, not in an insulting way, but in a warm fuzzy way. A woman won't say baka to any man except her boyfriend or husband. Not because it is disrespectful, but because she is too embarrassed.
One time I held a kompa and thought I'd try this out for some fun. In the usual kompa style, there were three guys and three girls sitting opposite each other. The girls were to look the guy opposite them in the eyes and say as seriously (but not angrily) as possible, "baka". For added emphasis, the word should be drawn out a few seconds.
Not one of the girls was able to say it. They sank in their seats, red-faced, giggling uncontrollably. Next was the guys' turn. Nor could they say it. Being called baka by a new boyfriend/girlfriend accompanied by a playful smack on the top of the head is considered a comforting sign of how well things are going.