Submarine generations are determined by the number of different classes built by a country. It is not universal and it is not dependent on technology. So, a fourth generation US submarine does not mean it is better than a Soviet 2nd gen submarine.
India's first gen Arihant is equivalent to or between a Soviet 2nd and 3rd gen submarine.
Aircraft generations used to be similar to submarine generations. But the technology advancement was way too fast after the 4th gen. The Chinese still follow the submarine generation in classifying aircraft while the world has moved on to technology based classification. That's why they are a generation behind when it comes to classification because they skipped the American first generation aircraft. If India follows submarine classification for aircraft then LCA would be our second generation aircraft which was preceded by Marut, our first generation.
Computers are classified into different generations too, but this was technology based, like Vacuum Tubes, Transistors, ICs, Microprocessors and AI. That's five generations.