Help for a small project for a small electrical circuit?
If I connect a fan with a dc motor, then as the fan rotates with the help of wind, will it generate power?

If you connect fan blades to a brushed dc motor, then apply enough wind power to turn the blades, then yes, it will generate an electric potential across the motor's terminals.

How much power it will generate depends kn the motor's efficiency, its rated output/draw, its rated RPM, the amount of wind striking the blades, and the size/shape/angle of the blades. Since you gave us none of that information, it's impossible for us to answer that for you.

If it does then how can I use the power for charging a battery?

First, calculate the system's output; then check the battery's charging data; finally, use those 2 sets of data to spec a dc-dc converter than can convert what you have to what you need.