Allowing you to work from home is purely a management decision; they can either deny or allow it. In your case, they have rejected your request, and that cannot be challenged.
Legal Considerations in Resignation
Moving on to the other part of the query, I would say that the company is not legally right. Firstly, they demanded notice from an employee to resign. Unless the employee has been carrying out some managerial functions, he cannot be asked to give notice. Secondly, the company has a notice period of two months as opposed to one month. (I presume it is not a factory, mine, or plantation employing more than 100 workers to which Chapter VB of the Industrial Disputes Act will apply.) Thirdly, when the employee resigned with a commitment to complete a 2-month notice period and requested to be relieved afterward, the company processed his relieving after the notice period and asked him to leave immediately. The company can do so, but in doing so, they should pay notice pay to the employee. In your case, it is now a situation where the employer is asking the employee to leave or simply terminating the contract of employment from the employer's side by offering notice pay, i.e., two months' salary.
Options for Resolution
Now, regarding the issue, there are various possibilities. You can choose any depending on the circumstances.
You can demand to be paid two months' salary. If they refuse, you can file a complaint before the appropriate authority. They will call for conciliation and ask the employer to pay notice pay and settle the matter. Certainly, when contacted by the Labor Officer, the employer will likely pay the amount and resolve the issue. However, the relieving letter may state that you have been "terminated" following the provisions of the ID Act. This could impact your future career prospects in a private establishment. You may consider this option if you are not joining another private organization but transitioning to government service or a job in a PSU, or if you are starting your own venture.
If you are not continuing your career in a private organization, you can consider accepting the early relieving and quietly exiting the company. Even in this case, there is an element of notice pay involved. You can negotiate for a waiver of the notice pay since it is an early relieving by the employer, where the employer is legally obligated to pay it to the employee. To do this effectively, it may be beneficial to involve someone other than Labor department officials who can influence the decision. You could also propose dropping the request for working from home but commit to coming to the office and completing assigned tasks.
HR Considerations
Keep in mind that an employee who has resigned cannot expect the same level of support and affection from the employer as before. The employer may try to distance themselves from employees who have decided to leave. However, there is an HR aspect to consider. The HR department should not seek retribution but rather act fairly and justly. It is important that HR does not misuse background verification to harm your career if you do not comply with their expectations. Many HR managers are unaware that the notice period does not apply to employees but only to employers intending to terminate an employee. They should not forget that a former employee who has faced harassment can tarnish the organization's reputation by sharing their experiences on social media.