Great sentence — it is correct!
What it means: In autumn (the season), and when it rains a lot, the forest becomes full of mushrooms.
Why the commas are okay: Commas are little pauses that help the sentence sound smooth. You have two time ideas: "In autumn" and "when it rains a lot." The commas put those ideas in the right places so the sentence is easy to read.
Here are a few other correct ways to say the same thing:
- When it rains a lot in autumn, the forest is full of mushrooms.
- In the autumn, when it rains a lot, the forest is full of mushrooms.
- In the fall, when it rains a lot, the forest is full of mushrooms.
All of these are correct. Nice work — keep writing!