A sleeping bag provides you with a way to stay warm. A tent provides you with some protection from bad weather and from bugs.

Hammocks all provide you with a way to sleep above the ground, which many people find more comfortable than sleeping on the ground. Hammocks designed for backpacking may also provide some of the protection from weather that a tent provides.

You did not mention tarps, but they also can be used to keep rain off you, or to divert wind away from you.

You can be in the forest in very warm, dry weather and not even need a sleeping bag, a tent or a hammock. The conditions you expect to meet will determine the choice of what gear you must bring.

My own choice is usually a sleeping bag and tent, with a sleeping pad underneath me. But I choose these because of the places where I hike and the weather that I hike in.