What looks like is happening is with the washing machine pumping the water out of the machine, it is pushing she water out of the trap so this is why you are getting smells.
As for the water backfilling you must have a slight blockage somewhere after the trap