Answer:
A transformer is an electrical machine which either steps up, or steps down, voltage. A substation is a location where transformation and/or switching takes place.
In its simplest form, a substation can be a pole- or pad-mounted transformer, together with its protective equipment (hv and lv fuses). In its most complex form, a substation can be a large fenced yard, containing several transformers, switchgear, busbar systems, and a building housing switchgear, busbar systems, and complex protective systems.
Substations do not normally contain generating plant (other, perhaps, than a standby generator).