Proper physical exercise can effectively promote appetite, and then you will eat more and supplement enough calories to gain muscle.
At the same time, physical exercise can help the growth of muscle fibers and make you stronger.
But the key to gaining weight and muscle is to eat more. Staple food and high protein food are good choices.
I suggest you go to the gym and ask the coach to help you arrange your diet and training plan.