Understanding Non-Compete Provisions in Employment Contracts
As such, there are no statutory or legislative provisions that prohibit a person from working in any organization. The only restrictions that apply in the situation you describe above emanate from employment, contractual, partnership, and other similar agreements or contracts. Collectively and popularly, these restrictions are referred to as 'non-compete provisions'.
If, at the time of accepting employment with company X, your 'contract of employment' or 'letter of appointment' contained non-compete clause(s), and you signed that letter or contract having been made fully aware of such clause(s) by company X, then company X may be within its rights to object to your working for company Z.
However, it's not as cut and dry as I've made it out to be in the previous paragraph. That is intended to give you fundamental info regarding a non-compete clause. It's one thing to have a non-compete clause. It's another thing to determine its veracity, legality, fairness, and, above all, enforceability.
Legal Perspective on Non-Compete Clauses in India
The Supreme Court of India has (in the recent past) declared unanimously that any non-compete clause that unfairly and unjustly infringes upon an individual's or a company's constitutional right to participate in employment or conduct business as their primary source of income in an area where they have core skills and those activities form their primary employment or business activity is unjust and unenforceable.
Even where the Supreme Court has found non-compete clauses to be legally sound, it has frowned upon any period of non-compete exclusion that exceeds 3 - 6 months (for companies) and 2 - 4 weeks for individuals.
The Supreme Court has also held that where a non-compete clause exists and the plaintiff intends to execute such clause, then in such circumstances, the plaintiff MUST compensate the disadvantaged party/parties to an amount not less than the last highest compensation which the defendant was entitled to immediately prior to the separation of both parties.
Common Occurrences and Compensation
This is a very common occurrence for merchant bankers, brokerage firms, legal firms, etc., where the disadvantaged party is prohibited from conducting any employment or business activity for up to 6 - 8 weeks post-separation. However, the disadvantaged party is compensated in full for the entire duration of non-compete provisions. These judgments have had a significant impact on partnership agreements and appointments of senior executives.
Specific Case Considerations
In your case, however, it could well be a case of bruised prestige or sour grapes. Because the truth is, if you were a contractor with company Y and they sub-contracted you to work for company Z, there is literally no remedy available to X to pursue a non-compete clause even if it's been meticulously drafted.
Also, the fact that you've been gone from X for over 2 months puts you on solid ground, even if X were to litigate against you. And, to litigate, they must first send you a formal 'cease and desist' notification citing enforceable provisions from your contract or appointment letter when you first started to work for them.
Disclaimer
DISCLAIMER: My reply to you on this post is intended as information ONLY. I am NOT a lawyer and do not intend for this post to offer you, or for its contents to be substituted for, construed (or misconstrued) whether inadvertently or by design, as legal advice - implied or explicit. I strongly encourage you to seek legal advice from a qualified and authorized lawyer to ensure the veracity of information upon which to arrive at an informed decision regarding next steps.
I hope this helps you. All the best!