Does market crash like in 1930 and 2009 are always due to excessive and careless lending activity? Lets say all lending is done in careful manner and no corporate fraud is done somehow, would it be possible to avoid these types of crashes forever than, after all money moves among people only? I know very less economics.
This is a rather big question, and I am only attempting to give a partial answer. (This is perhaps an extended comment.)
Firstly, the belief that "market crashes" (in a wide sense) are due to speculative lending activity is an argument that overlaps Hyman Minsky's Financial Instability Hypothesis. This is described in various books of his, "Stabilizing an Unstable Economy" was reprinted a few years ago and is easy to get. Not everyone agrees with the theory, but I would look up the existing literature if you wanted to pursue this idea.
Minsky argued (I do not have any references handy, but I believe that "Stabilizing an Unstable Economy" would cover this topic) that there is a tendency for capitalist economies to drift towards speculative, destabilising activity. However, the memories of the Great Depression were strong in the 1950s, and speculation was frowned upon. As a result, the early post-war period saw strong growth and an absence of financial crises. However, memories faded, and there have been recurrent financial crises since the 1960s. (Minsky predicted this rising instability.) The 1950s experience showed that it was possible to avoid financial crises, yet at the same time, that period of stability ended.
However, it is clear that not all market crashes are always associated with financial instability. As an extreme example, the stock and bond markets of countries that are about to be invaded typically crash. (I am aware of bond market defaults in response to invasion; I do not know what happened to the equity markets in those episodes.) We can imagine that various market shifts (new technologies, new resource discoveries) that could wipe out the market value of certain types of equities, which may or may not be a "crash."
You get a crash, when loans go bad, or when there are excessive stock valuations, and everyone sells at the same time, and tries to run out the door at the same time.
Think of the tech bubble at the end of the 90's, a lot of people realized that the P/E's (Price/Earnings) where unsustainable. Either the profits weren't there or the growth and profits weren't there.
Loans going bad is the other big reason for crashes, money is lent out to company xyz, but for whatever reason, xyz can't deliver.
Other reasons are loans can't be renewed on favorable terms. The fed hikes rates and things that where profitable, become unprofitable because of higher interest costs.