Alternating current is produced by a type of generator called an alternator.
Direct current is produces by a generator called a dynamo, or by rectifying altenating current, or solar panels, or cells and batteries.
To get alternating current :
consider a coil subjected to a varying magnetic field ,then an voltage is induced across its ends
If the magnetic field in coil is varied by rotating the coil in a magnetic field Then the voltage varies from zero to maximum,then maximum to zero, then reverses direction ,varies from zero to maximum,then back to zero This variation takes place during one full rotation of the coil When a resistor is connected across its ends then the current in the circuit is alternating If the coil is rotated 'n' times in one second then we get an alternating current of frequency 'n'
To get direct current :
Either use an ordinary cell AA,AAA,etc or the alternating current from the domestic power supply can be converted to direct current using rectifiers