Acyl chlorides (also known as acid chlorides) have the general formula RCOCl. The chlorine atom is very easily replaced by other things. For example, it is easily replaced by an -NH2 group to make an amide.
Figure 1: Acid chlorides react with ammonia, 1o amines and 2o amines to form amides
To make ethanamide from ethanoyl chloride, you normally add the ethanoyl chloride to a concentrated solution of ammonia in water. There is a very violent reaction producing lots of white smoke - a mixture of solid ammonium chloride and ethanamide. Some of the mixture remains dissolved in water as a colorless solution. The reaction can be thought of as happening in two stages.
In the first stage, the ammonia reacts with the ethanoyl chloride to give ethanamide and hydrogen chloride gas.
\[ CH_3COCl + NH_3 \rightarrow CH_3CONH_2 + HCl\]
Then the hydrogen chloride produced reacts with excess ammonia to give ammonium chloride.
\[ NH_3 + HCl \rightarrow NH_4Cl\]
. . . and you can combine all this together to give one overall equation:
\[ CH_3COCl + 2NH_3 \rightarrow CH_3CONH_2 + NH_4Cl\].
Jim Clark (Chemguide.co.uk)