Dialectical materialism is a way of understanding reality; whether thoughts, emotions, or the material world. It is a scientific methodology developed from the principles of dialectics and materialism, and is one of theoretical foundation of Marxism (the other two are the labour theory of value and the class struggle or more generally the theory of the state).
To understand how dialectical materialism came to exist, it is necessary to briefly go through how both of those components came to exist. In ancient Greece, dialectics was the name given to the art of argumentation. It was considered that in the course of an argument, rich in fertile ideas, the opinions of the disputing parties underwent a change and that something new and of a higher nature resulted.
The ancient Greeks also theorized about materialism but, at the time, materialism referred to the idea that everything is made of matter. They said that everything is made of tiny particles invisible to the naked eye, and that the properties of these atoms made the properties of the resulting object. For example, oil atoms were big and smooth, and vinegar atoms were very small and pointy. They were not entirely wrong (we later discovered atoms and reused their term, but the properties of actual atoms and what the Greeks thought atoms were are very different), but their meaning of materialism was not any more developed than that.
The Ancient Greeks were but one example, and idealism still permeated their cultures. They theorized, for example, that since everything is made of matter, then the gods must live on Earth somewhere -- rather than completely dispelling the ideas of gods (which is idealism), they tried to fit them into their philosophy.
Starting around the Enlightenment (late 18th century Europe), science emerged as a field -- with its rules and methods -- mostly led by nobles who had the time and means to do scientific experiments. These nobles were the first materialists, so-called metaphysical (beyond physics) as they did not yet possess the full knowledge necessary to understand dialectics since they were just starting out on scientific experiments in a world still dominated by idealism and feudalism.
Later on, philosopher Hegel used dialectics to describe the progress of ideas (thoughts) through contradiction, the process of its development toward a supreme and absolute spirit. Hegel's fundamental question was: where do our ideas come from? How come this or that person had the idea to invent, say, the telephone? How come we didn't have the idea for it earlier? His answer was God, though in that case "God" is more of a concept that means "we may never know".
Marx and Engels were first inspired by Hegel's works and ideas, but later developed a better understanding of reality and its progress and development by applying the dialectical logic to material reality, observing the historical development of society. They put dialectic back right-side up, by divorcing it from its idealist roots and correctly associating it with materialism. To the question of where do our ideas come from? Dialectical materialists reply: from the brain, as the result of a chemical interaction. But moreover from our material conditions; the reality in which we live. Indeed, we know for example that the Ancient Greeks had experimented with steam machines. Yet they didn't use them for industrial production, and steam only gained traction in the industrial revolution when we found out about its power output. Idealists would say that the idea already existed in the time of the Ancient Greeks, but the fact that they did not use steam technology (and it was limited to a couple experiments) shows us material conditions are more important than having the right idea. Essentially, the possibilities of steam did not fit into the Greek mode of production, whose societies by and large relied on slave labour.
It would be wrong to say that dialectical materialism is only the logical progression of Hegelian dialectics. Dialectical materialism has its own rules, methods and roots that set it apart from Hegel's idealist dialectics. It could not have existed meaningfully earlier in time, as the material conditions and the dialectic was not sufficiently advanced for these ideas to take hold. This is an entirely dialectical observation, and a good example of what material dialectics are.
Most of what dialectical materialism is, comes directly from Hegel. Where Marx and Engels innovated was in two major ways. The relationship between quantity and quality. And the reorientation of the the primary mover being the material, rather than spiritual, or ideal realm. 
Laws of dialectics
Transformation of quantity into quality and vice versa
All change has a quantitative aspect, that is, an aspect of mere increase or decrease which does not alter the nature of that which changes. But quantitative change, increase or decrease, cannot go on indefinitely. At a certain point it always leads to a qualitative change; and at that critical point, the qualitative change takes place relatively suddenly.
A classical example of this is water. If water is being heated, it does not go on getting hotter and hotter indefinitely; at a certain critical temperature, it begins to turn into steam, undergoing a qualitative change from liquid to gas. Another example is a rope used to lift a weight, which may have a greater and greater load attached to it, but no rope can lift a load indefinitely great: at a certain point, the rope is bound to break. We can measure the weight attached to the rope as a quantity, a number, and the qualitative change is the fact that the rope broke. It was whole, now it's broken. Dialectical change has happened to it.
There is a very important component to take into account here, and that is the rule of autodynamism. Change in dialectics comes from internal forces; if change has happened through external forces, then it is not dialectics. For example if you put an apple into the juicer, then the solid apple has transformed into a liquid. While that is change, it is not internal change: you have applied mechanical force to the apple.
Unity and struggle of opposites
Everything exists only in relation to an opposite or contrary thing. The two opposites are therefore united by the interdependence on the existence of the other, yet also struggle against each other. This is also known as a contradiction.
As Mao explained in On Contradiction, there is a contradiction when two things are fundamentally opposed, but one cannot exist without the other. In this case a thing can be anything: ideas, concepts, commodities, fields of science, tangible items...
Examples include the contradiction between theory and praxis. Theory can only exist in relation to practice with the real world (praxis), and praxis cannot exist without practicing theory. Theory without practice leads to metaphysics and unreliable ideas; praxis without theory leads to vulgar empiricism and ineffective action and therefore, theory and praxis are in contradiction as they struggle to adjust to reflect each other.
Negation of the negation
Progress by leaps
Progress happens by leaps. It should be understood that progress does not mean being progressive, but merely that things change; that something that once existed does not anymore. Once a critical point is reached, then change happens meaningfully. We see for example that feudalism was not deposes by reforms in parliament or to the monarchy, but by revolution headed by bourgeois and capitalists. The same thing can be said about water: when heated, water does not gradually make more steam the more it's heated. It will start off not making any steam, and then once it reaches a certain point, steam starts. This means something can stay still for years (such as a communist party not making any progress), and then suddenly make progress (such as the communist party suddenly seeing a surge in new members as the contradictions of capitalism worsen).
An apple is not set in stone. It will not remain an apple forever. Before being an apple, the fruit was a flower, and before that a bud on a branch. As we can see, change has happened to the apple and will continue to happen. The apple will ripen, and later will fall off the tree and then start rotting, feeding more life. The process goes on forever even if, at some point, anyone looking at the apple will say "this isn't an apple anymore, it's just mush". The apple itself has stopped existing, but it was just one stage of an ongoing process and the process itself still exists. Incidentally, this is what metaphysical materialists don't understand. They will study the apple as it is an apple, not seeing the whole process. One branch of science will study the apple, and another will study the flower that later becomes the apple.
There is a very apparent contradiction in the class struggle. The bourgeoisie is fundamentally opposed to the proletariat -- as the former wants to extract more value from their employees, while the latter wants to retain more value from their employer. Yet one class cannot exist without the other: if the bourgeoisie did not have the proletariat to exploit, then they would change into another class over time. For a concrete example, we can look at the end of feudalism. The Bourgeoisie revolted against the old régime of the nobles and feudal masters and eventually took power (such as in France). Before that point, the bourgeoisie existed side-by-side with the nobles and both competed for the supremacy of their class (as in class society, there is always an exploiting class and exploitative class). Yet the proletariat did not exist side-by-side with the serves. There were free cities, in which guilds operated and they employed workers by the day or week, but this is different from the proletariat (as seen in Principles of Communism). It was only after the feudal order was abolished, with the bourgeoisie taking over the state, that the proletariat developed itself. Thus the contradiction mutated, and the class struggle moved from the nobles and serves to the bourgeoisie and proletariat.
To exemplify another rule of dialectics, we also see that quantitative change leads to qualitative change. Essentially, as more people became either bourgeoisie or manufacture workers (the ancestor of the proletariat), their numbers grew -- quantitative change. When their numbers grew enough and it was impossible for them to develop as a class any longer, and they had a chance of seizing state power, they did -- and if it was successful, then this quantitative change led to qualitative change.
- Lenin, The three sources and three components of Marxism. Read here : https://www.marxists.org/archive/lenin/works/1913/mar/x01.htm
- V. Adoratsky. Dialectical materialism – the theoretical foundation of Marxism-Leninism, pg. 22-23
- Humphrey McQueen (year of publication unknown). from Hegel’s Logic to Lenin’s Imperialism and beyond.
Elementary Principles of Philosophy by Georges Politzer