To set up the automatic generation of product codes, go to Settings > Additional Settings > Product Settings and tick the option to Automatically generate product codes and then Save.
Next time you create a product, the product code will automatically default to "AUTO" until the product is saved. Your product code will then be formed by the first 4 characters of the product category field and the automatically generated system ID.