This is a good question. However, it must be stated that marijuana is illegal in all States (apart from medicinal uses in some states). California was the first to legalize Marijuana for this purpose (Proposition 215). The reason why it is illegal is for the following reasons.
First, during the prohibition period there was a perception that marijuana was a horrible drug that was highly addictive. This perception lasted and made marijuana illegal. There is, of course, inconsistency here, because alcohol is addictive as well - not to mention tobacco.
Second, marijuana was also coupled with harder narcotics like heroin. Moreover, it was argued that marijuana was a gateway drug.
Third, there is also a racial component. It was part of the anti-Chicano movement of the 1930. Banning marijuana was a way of hindering this movement.
Finally, from a more cynical point of view, alcohol and tobacco lobbyists are too strong. They do not want additional competition. Moreover, the government may not be able to tax marijuana.