The details you have furnished are quite sketchy. However, from what I understand, you were on the rolls of Company X, which deputed you to work at Company Y. Therefore, you are an employee of Company X and not Y.
Notice of Resignation
Did you give a proper notice of resignation and serve during the notice period to your employer, i.e., Company X, in accordance with your offer of Appointment or relevant terms and conditions of employment? Did your employer accept your resignation and release you formally at the end of the notice period?
Legal Action
If your response to the above is YES, you may need to have a legal notice served upon your previous employer. As you have not mentioned the job you were performing, it is difficult to advise you on whether you can take advantage of labor statutes or if you need to approach a civil court.
Please provide complete facts for quality replies/advice.