Muscles and fats are made up of very different types of cells that have completely different functions. Skeletal muscles get larger when a person exercises. The muscles get larger, with more filaments being developed within the cells to accommodate the more challenging demand on them.
After a person quits exercising, the muscle cells do not magically turn into fat cells. They just shrink. This allows the body to conserve energy when a person’s daily activities don’t require as much muscle mass.
The myth that muscles turn to fat when a person stops exercising probably stems from the fact that people who body build or otherwise exercise regularly and quit, tend to put on weight.
It all comes down to caloric intake. People who exercise regularly tend eat more food and when they stop exercising their body loses the need for the calories. These people may not reduce their food intake quickly enough to compensate for their reduced caloric needs.