A washing machine may smell like methane gas due to a problem related to the sewer line. It may smell like gasoline because clothes that had gasoline on them were placed in the washer during a prior wash.
A methane gas smell in a washing machine is typically caused by sewer water trapped in the pipes connected to the washer. If pipes or traps were not installed correctly or become clogged, methane gas from sitting water becomes trapped, and odors from that gas may emanate from the washer. Clothes that have gasoline spills may also leave an odor after they are washed in a washing machine. This causes a build-up of oily gasoline in the drum of a washing machine that may still be present during subsequent washes.