The processes can be done by one person or separate people for each step.
The engineering part is the role of the recording engineer. They set up the recording (mic positioning, levels, etc) and capture the individual tracks from the musicians - the drums, the lead guitar, the vocals are each recorded independently.
The mixing step is where the individual 'stems' are mixed down into one two channel or multi-channel track. That involves things like relative levels and timing of the individual tracks with respect to the whole mix; eg, aligning the kick of a kick drum with a vocal emphasis and things of that nature.
The mastering step is the final polishing step. The mastering engineer does things like apply compression, eq, and fades.
The steps can overlap and can be more complicated than my simple little explanation. The mastering engineers are the ones that are mainly responsible for the cd loudness wars, although the recording engineers probably also capture the stems with the record levels set high as well.
As a side note, CDs use to have a designation like A/D/D on them (haven't seen that much lately). That means recorded using Analog equipment, mixed Digitally, and mastered Digitally.