Poorly lubricated sewing machine parts often cause a knocking noise in a sewing machine. An internal gear problem can also cause knocking.
Oil the sewing machine when it's knocking. Prevent knocking by oiling the machine at least once a year or every 3 months if you use the sewing machine regularly. If the machine has been stored for an extended period, oil it before use.
If the sewing machine continues to knock after being oiled, an internal failure likely is causing the knocking. Have a technician service the sewing machine.