What is the cause of temporary smell and black color of underground water?
This is due to the presence of iron sulfide in the water. The iron sulfide oxidizes and goes into solution. Ferrous iron oxidizes to ferric iron. Depending on the water chemistry, this commonly precipitates out as orange-coloured iron oxyhydroxide, but that does not seem to be occuring in your case, otherwise you would see it. When it does happen, the pH of the water drops, as seen in acid mine drainage.

The sulfide may be volatilized as hydrogen sulfide which smells, or it too may oxidize and volatilize as sulfur dioxide (rotten egg smell). It can continue to oxidize to sulfate.

The iron sulfide may be present in the aquifer or it may be formed by microbial activity in your well. In the latter case, treating the well with bleach can solve the problem, at least temporarily. Be sure to treat all the piping, too. If possible, install a backflow preventer so water doesn't flow back down the well.