for example we have a DNA from E. coli and we have a specific primer pair for X gene. when we perform the PCR and check the PCR products we found a non specific products in addition to the product of interest X gene. what is the best explanation?
Yes, Tannealing optimization is the first step you should do, but quite often, the problem cannot be fixed by higher Ta - when the primers were designed for target gene of model Ec strain without searching for homologous sites across many Ec genomes (true for some old works).
if you have a pseudogene or similar gene family member or even contamination of the dna from another species then this can be a problem. For non specific priming you can try adding DMSO or temperature gradient pcr or touchdown pcr . Sometimes one primer has analogy with a repeat sequence and just one primer can be close to itself in reverse orientation and a repeat product is produced. In this case pcr works with just one primer...try it and if you get a product with only one primer then re design that primer
Following onto Paul Rutland's reply, it's always a good exercise to BLAST your primers and look for any potential red flags that in silico algorithms might detect.
In case your specific primers have a short sequence then the chances of non specific binding is higher. Gradient PCR might help you in finding the optimal conditions.