Genitive case = negatives and numbers. "No chocolate" is genitive case. Male singular nouns like chocolate get an "a" at the end when genitive. Шоколад becomes шоколада. Table (стол), no table (нет стола), two tables (два стола). Careful, the genitive case ending changes when you have five or more. Five tables (пять столов).
"I am not eating chocolate" vs. "I have no chocolate".
This is particularly clear here because of the way the idiom у меня не шоколада fits together. It's my understanding that in negative sentences like this, you don't use есть, which means there is no verb for не to attach to, so it can't function as in Я не ем шоколад.
In other words, since there is no verb in У меня не шоколада, the не attaches to the noun. causing it to be cast in Genitive case. In Я не ем шоколад, не clearly attaches to the verb, and шоколад is just an inanimate Accusative-case direct object.