Before, going through the concept of first law of thermodynamics, we have a short glance on Joule's law because it is the first step for the first law of thermodynamics.
When certain amount of work is done, then equivalent quantity of heat is produced, conversely we can say that in order to do some mechanical work certain amount of heat is needed.
Suppose we take a electric heater, in order to heat the water i.e., work, equivalence of heat is needed. Again, that is supplied as current to the heater, that current is produced due to some mechanical work at turbines of water electricity equipment at dams, i.e., it is cycling process or cumulative process of producing heat and mechanical work and their equivalence, that can be identified as proportionality constant 'J'. Whatever, Joule explained same one is extended by the first law of thermodynamics.
In order to understand the first law of thermodynamics, we take the example of boiling of the water in vessel on a stove. When the heat is supplied to the vessel containing the water, first of all,
molecules of water get accelerated or moved, i.e., internal energy increases and then the boiled water produces water vapour which causes the closed plate of vessel to fall down, i.e., there is some external work is done on the plate.
From this example, we conclude that whatever heat is supplied to the system,one part is used to increase internal energy, the remaining part is used to do external work.
Another example, we take a bike, when petrol is poured in the tank of the bike and started, the engine produces heat in which one part causes the molecules of the petrol to be moved, i.e.,
internal energy and then another part is used to move the bike, i.e., the external work