While that is a logical assumption, it’s not actually true. [1]
If you intake X calories, your body will use them to provide you energy for exercise. If you don’t exercise, you won’t always just turn it into fat - your body will find another find other uses of the calories such as producing stress hormones.
Exercise is important but will not make you lose weight alone.