Main Difference
The main difference between Joule and Erg is that the Joule is a derived unit of energy, work, or amount of heat in the International System of Units and Erg is a unit of energy and mechanical work; 100 nanojoules

Joule
The joule (); (symbol: J), is a derived unit of energy in the International System of Units. It is equal to the energy transferred to (or work done on) an object when a force of one newton acts on that object in the direction of its motion through a distance of one metre (1 newton metre or N⋅m). It is also the energy dissipated as heat when an electric current of one ampere passes through a resistance of one ohm for one second. It is named after the English physicist James Prescott Joule (1818–1889).
In terms firstly of base SI units and then in terms of other SI units:
J
=
kg
⋅
m
2
s
2
=
N
⋅
m
=
Pa
⋅
m
3
=
W
⋅
s
=
C
⋅
V
,
{displaystyle {text{J}}={frac {{text{kg}}cdot {text{m}}^{2}}{{text{s}}^{2}}}={text{N}}cdot {text{m}}={text{Pa}}cdot {text{m}}^{3}={text{W}}cdot {text{s}}={text{C}}cdot {text{V}},}
where kg is the kilogram, m is the metre, s is the second, N is the newton, Pa is the pascal, W is the watt, C is the coulomb, and V is the volt.
One joule can also be defined as:
The work required to move an electric charge of one coulomb through an electrical potential difference of one volt, or one “coulombvolt” (C⋅V). This relationship can be used to define the volt.
The work required to produce one watt of power for one second, or one “wattsecond” (W⋅s) (compare kilowatthour – 3.6 megajoules). This relationship can be used to define the watt.

Erg
The erg is a unit of energy equal to 10−7 joules. It originated in the centimetre–gram–second (CGS) system of units. It has the symbol erg. The erg is not an SI unit. Its name is derived from ergon (ἔργον), a Greek word meaning ‘work’ or ‘task’.An erg is the amount of work done by a force of one dyne exerted for a distance of one centimetre. In the CGS base units, it is equal to one gram centimetresquared per secondsquared (g⋅cm2/s2). It is thus equal to 10−7 joules or 100 nanojoules (nJ) in SI units. An erg is approximately the amount of work done (or energy consumed) by one common house fly performing one “push up”, the legbending dip that brings its mouth to the surface on which it stands and back up.
1 erg = 10−7 J = 100 nJ
1 erg = 10−10 sn⋅m = 100 psn⋅m = 100 picosthènemetres
1 erg = 624.15 GeV = 6.2415×1011 eV
1 erg = 1 dyn⋅cm = 1 g⋅cm2/s2

Joule (noun)
In the International System of Units, the derived unit of energy, work and heat; the work required to exert a force of one newton for a distance of one metre. Also equal to the energy of one watt of power for a duration of one second. Symbol: J
“The Greisen–Zatsepin–Kuzmin limit (GZK limit) is a theoretical upper limit on the energy of cosmic rays (high energy charged particles from space) coming from “distant” sources. The limit is 5×10^{19} eV, or about 8 joules. The limit is set by slowinginteractions of cosmic ray protons with the microwave background radiation over long distances (~163 million lightyears). The limit is at the same order of magnitude as the upper limit for energy at which cosmic rays have experimentally been detected. For example, one ultrahighenergy cosmic ray has been detected which appeared to possess a record 50 joules (312 million TeV) of energy (about the same as a 60 mph baseball).^{wGreisen–Zatsepin–Kuzmin limitWP}“

Erg (noun)
The unit of work or energy, being the amount of work done by a force of one dyne applied through a distance of one centimeter. Equal to 10^{−7} joules.

Erg (noun)
A large desert region of sand dunes with little or no vegetation, especially in the Sahara.

Erg (noun)
An ergometer.

Erg (verb)
To use an ergometer.
“I erg every morning.”
“She erged a steady state piece.”