The hammer and the hanging man are the same candle: a small body near the top of the range with a long lower wick and little or no upper wick. The long lower wick means sellers pushed price down hard but buyers rejected those lows and closed it back near the top. What the candle means depends entirely on where it appears.
Same shape, two stories
At the bottom of a downtrend, this candle is a hammer — a bullish sign that sellers tried to extend the move and failed. At the top of an uptrend, the identical shape is a hanging man — a warning that selling pressure has appeared even though buyers managed to recover the close. Location decides.
Confirmation
Neither candle is a trade by itself. A hammer is confirmed by a strong close above it on the next candle; a hanging man by a breakdown below it. The longer the lower wick relative to the body, the stronger the rejection it represents.