Well, I don't quite like the question itself. It's like asking why people are short.
Well, not all people are short. Some individuals are short, whereas others are tall, and some are of intermideate height. You can ask why short people are short but you can't ask why all people are short.
So, returning to your question, you can ask why some compounds are optically active whereas others are not.
Then you can go with this question further:
If the compound is optically active its diastereisomers are also optically active (short people are short).
Ernest Z. wrote really great answer to your question but meso compounds are not considered as diastereisomers. (Well, It's about how different textbooks interprete it but as far as I remember the compounds are not diastereisomers). Anyways, I hope you've got the idea.
You can read more about diastereisomers and meso compounds here:
Ask me if you need to know how to determine optical activity.