In this case, "short" has the meaning of "not enough". If you are short of money, it means you don't have enough money.
Literally, "one sandwich short of a picnic" means you are lacking one "sandwich" to have a complete picnic. In this idiom, it means you are stupid - you have some mental capacity, but definitely not enough to be logical or sane.
In addition to the other idioms above, there is "a beer short of a six-pack", with the same meaning.