The key to the proof is to think of Martin's axiom as the assertion that "a lot of c.c.c. forcing has already taken place". Thus, to force MA, what you need to do is to force over as many different kinds of c.c.c. forcing as you can imagine, and to do so again and again as long as they remain c.c.c. Of course, we won't literally force over all c.c.c. forcing, since this would continually push the continuum higher and higher, as $\text{Add}(\omega,\theta)$ is c.c.c. for any $\theta$. But luckily, there is a lemma that MA is equivalent to the assertion involving only c.c.c. forcing of size less than the continuum.
So we only really need to consider forcing notions of size less than continuum. So the strategy, aiming just for the case $\kappa=\omega_2$, which illustrates all the important ideas, is to start with GCH and force with as many different c.c.c. forcing notions of size at most $\omega_1$ as we can imagine, in an iteration of length $\omega_2$. This will necessarily have the effect of pushing up the continuum to $\omega_2$, because we will very often have to be adding a Cohen real.
So, we perform a finite-support iteration $\mathbb{P}$ of length $\omega_2$. At stage $\alpha$, think of $\alpha$ as coding a pair of ordinals $\langle\beta,\gamma\rangle$, where $\beta\leq\alpha$. Let $\mathbb{Q}_\alpha$ be the $\gamma$ th poset (with respect to some well-ordering fixed in advance) in the stage $\beta$ extension $V[G_\beta]$, regarded as a partial order in $V[G_\alpha]$, provided that this partial order is still c.c.c. there. Let $G\subset\mathbb{P}$ be $V$-generic for the iteration. This is a c.c.c. iteration, and so preserves all cardinals. The continuum becomes $\omega_2$, since we very often chose to add a Cohen real. Meanwhile, if $\mathbb{Q}$ is any c.c.c. partial order in $V[G]$ and $D$ is a family of at most $\omega_1$ many dense sets in $\mathbb{Q}$, then since $\mathbb{Q}$ and $D$ have size $\omega_1$, they are already known at some stage of the forcing $V[G_\beta]$ for $\beta\lt\omega_2$, and so $\mathbb{Q}$ arises at some later stage $\alpha$. At that stage, we add a $V[G_\alpha]$-generic filter $F\subset\mathbb{Q}$, which is therefore also $V[G_\beta]$-generic and consequently $D$-generic. And so this instance of MA is fulfilled by the iteration.
The general case of making the continuum equal to $\kappa$ is essentially the same idea. The iteration simply proceeds longer, and handles more and larger forcing notions.
The idea of this proof extends to many other iterations, which are trying to force over as many different partial orders of a certain type as possible. For example, this same idea arises in the Laver preparation and in the Baumgartner forcing of PFA, and in the lottery preparation.
One curiosity: although MA asserts essentially that "a lot of c.c.c. forcing has been done", and Tony Martin confirmed to me (while riding together on a river tour boat in Poland) that this idea was present from the start in the treatment of this axiom, Jonas Reitz proved in his dissertation that MA is consistent with the Ground Axiom, which asserts that the universe was not obtained by (set) forcing at all.