If the noise was coming from the wheel, you'd hear it whether you were pedaling or not. The noise is more likely coming from the ratcheting mechanism in your freewheel/freehub, which only rotates when you're not pedaling.
To solve the problem, the first step is to identify what kind of freewheeling mechanism you have.
Second, remove the freewheel (or the cog on your freehub) and reinstall it. If the problem was caused by a misalignment, you're done.
Third, if the problem persists, it means you have gotten dirt inside the bearings, or they have been worn out. Freehubs can often be saved (see the Park Tool site on Freehub Service for details), but otherwise you need to replace your freewheel or freehub.