There's a good discussion about this earlier around "crema al cioccolato" this is apparently how Italians say chocolate cream, similarly "gelato al cioccolato" is chocolate ice cream. It's an interesting little twist on sentence structure which I wouldn't have guessed either.
There is no direct relationship between torta and cioccolato here like between a noun and an adjective: they are both nouns.
al stands for 'with the flavour/taste/ingredient of'.
For the records, both cioccolato (masculine) and cioccolata (feminine) exists (the difference between the two is irrelevant in this thread). If you want to use cioccolata then you need to change the al (a+il) to alla (a+la): torta alla cioccolata.