May I, please, know the differences in their meaning and usage? Or is it just a matter of collocation, as how they appear in different contexts?
Defect = broken/faulty, basically. 'The product was defective' means it has some problem and doesn't work, or doesn't work properly.
Deficiency can mean the same thing - 'the movie had a number of deficiencies' which means there were a number of problems with it, but it also relates to the amount of something, and indicates that there is not enough of something. An anaemic person suffers from an iron deficiency.
I would say that the second meaning (not having enough of something) is the most common use of the word.