In this "less civilized age", to paraphrase Obi-Wan, it takes far less training to get by in lightsaber combat. The old Jedi Order is long gone, and when it was destroyed, much of the finesse and skill possessed by its members went with it. As a result, the best lightsaber combatants in The Force Awakens are far less talented than the average Jedi was in the days when the Jedi Order was still alive and well.
Erosion of Lightsaber Skills After the Destruction of the Jedi Order:
In addition to the suggestions made in the other answers (i.e., that stormtroopers may indeed have some training with melee weapons), it makes sense to consider what we saw in the original trilogy.
In Episode IV, Luke probably spent a few days aboard the Millennium Falcon with Obi-Wan, and received some very rudimentary lightsaber training during that time; the only training we actually saw was basically blaster-deflection practice against the remote droid.
In Episode V, Luke trained with Yoda for a while, probably less than a month. This training seemed to be focused mainly on physical fitness (running around, climbing vines, etc, with Yoda on his back), Force skills (lifting rocks, droids, and an X-Wing, doing headstands, etc), and mental preparation for facing Vader (the cave scene). As far as we know, there was no lightsaber training involved in the regimen on Dagobah, and we have no reason to believe that Yoda still owned a lightsaber. Even if Yoda did have his lightsaber stashed away somewhere, it is hard to imagine him using it during Luke's training, since he had clearly become extremely frail during his decades in exile; only a couple of years after he met Luke, he died of old age.
Despite this, Luke did reasonably well against Vader in their first lightsaber duel - during the fight, Vader complimented his skills and said Obi-Wan had trained him well. Yes, he lost a hand, but it's actually pretty impressive that he wasn't hurt worse, considering the fact that he had only used his lightsaber twice before that (once to lop off a Wampa's arm, and once to cut open the hull of an AT-AT on Hoth), and had never been in a duel before, let alone a duel with one of the most powerful Force-Users in history. Faced with such a formidable opponent, it is somewhat surprising that he was able to hold his ground for as long as he did, even if we take into account the fact that Vader was holding back and not really trying to kill him.
After his first fight with Vader, Luke had no further lightsaber training, as far as we know, and he only used his lightsaber against mooks (Jabba's cronies and some stormtroopers) between the first and second duels with Vader.
In his second and final lightsaber battle with Vader, for most of the fight, he does no better than he had in their first encounter - he holds his ground most of the time, but still struggles to keep up with Vader, even though Vader is old and limited by his injuries, armor, and robotic limbs.
In the end, Luke beats Vader, but not because he's skilled in lightsaber combat - he has none of the acrobatic skill, dexterity, and elegance we see the Jedi command in the prequel trilogy. He wins because he flies into a rage and begins flailing away as hard as he can. The Jedi in Episodes I-III move like ninjas, flipping around, making precise strikes with unbelievable speed and skill, but in the climactic duel in Episode VI, Luke ends up looking like an enraged barbarian swinging a club with all his might. There is no finesse or talent involved in the final moments of the contest, just Luke's frenzied smashing, and Vader desperately trying to fend off the barrage of sledgehammer blows. Soon enough, Luke's fury is too much for the elderly Vader to withstand, and the young Jedi lops off his father's hand.
Which brings us, at last, to The Force Awakens. We don't know what Luke was up to between the end of RotJ and the beginning of his attempt to rebuild the Jedi Order, but we can probably assume that he didn't have many opportunities to improve his lightsaber skills in actual combat with other trained Force Users. Kylo Ren was trained by Luke, and his training was apparently far from complete when he turned to the Dark Side, killed the other Padawans, and joined the First Order.
This puts Kylo in a position much like Luke's circa Episode V: the Force is strong with him, but he has very little training, compared to the Jedi we saw in the prequel trilogy. Obi-Wan, Yoda, Mace Windu, etc, had been trained over decades in a controlled setting in accordance with traditions stretching back thousands of years and under the tutelage of dozens of Jedi Masters who had enjoyed a similar abundance of training.
Luke had received a few weeks of haphazard training under only two Jedi, one of whom (Obi-Wan) had very little experience as a Master, both of whom were very old and traumatized by having witnessed the destruction of the Jedi Order, and both of whom were forced to work in conditions that were far from ideal. Luke received less training than a Youngling would have when the Jedi Order was intact, and never experienced anything like the years of intimate, one-on-one mentoring and apprenticeship that the Padawans used to go through.
As limited and incomplete as Luke's training was, Kylo Ren's training was even less thorough, because he only had access to Luke's knowledge, and it seems safe to assume that Luke didn't teach Kylo everything he knew. So Luke only knows a tiny fraction of what Obi-Wan and Yoda knew, and Kylo Ren only knows some fraction of what Luke knows.
As such, we can assume that if a fraction of Obi-Wan and Yoda's knowledge plus some wild flailing allowed Luke to beat Vader, then Finn, who has no Jedi training, but who received a modicum of melee combat training, can wildly flail against Kylo Ren and do at least a little damage before being cut down.
However much melee weapon training Finn received as a stormtrooper, it wouldn't have helped him at all in a lightsaber duel with a Jedi from the prequel trilogy, because those Jedi were endowed with an immense amount of training and knowledge. But Kylo Ren only received a portion of Luke's knowledge, and Luke only received a portion of Obi-Wan and Yoda's knowledge, so Kylo is a much less formidable adversary than the old school Jedi and Sith were. As such, less skill is needed to fight Kylo Ren than one of the Jedi or Sith in the old days.
Lightsaber/Sword Combat in General:
Finally, melee combat is fairly intuitive - the basics are obvious to anyone, even if you have no training whatsoever:
Hit the other guy until he's dead.
Don't let the other guy hit you or you'll be dead.
That's really all you there is to it - sword fighting consists of different methods of obtaining these two related goals, hitting the other guy while preventing him from hitting you. The less skill your opponent has, the less skill you need in order to beat him.
Finn's Skills With Lightsabers/Swords:
Clearly, Finn had less skill than he would have needed to beat Kylo Ren, because he lost. He couldn't even beat a mere stormtrooper in melee combat, despite the facts that (1) Finn's weapon was superior, and (2) the other stormtrooper's training was presumably not much better than Finn's. But the amount of skill he would have needed to beat Ren was less than what Ren would need to beat Luke in Luke's prime, and Luke's relatively meager skills were enough to beat Vader; however, it is highly unlikely that Luke could have beaten Anakin prior to Anakin's dismemberment at the hands of Obi-Wan.
Finn probably received at least some basic training in the use of melee weapons, because other stormtroopers seem to demonstrate some degree of proficiency in this regard, and such training is fairly standard in real-world military instruction (e.g., bayonet training in boot camp). Furthermore, the basics of melee combat are fairly intuitive, because the fundamental concepts are so obvious - hit the other guy and prevent him from hitting you. Finally, no one in The Force Awakens is as competent in lightsaber combat as the old Jedi Order was, so less skill goes farther than it used to in the old days. Thus, Finn's paltry skills allow him to do reasonably well in melee combat, but he struggles to survive a duel with a stormtrooper with better training, and even Kylo's relatively meager abilities with a lightsaber (compared to, say, Mace Windu or Yoda in their respective primes) are far too much for Finn to withstand. So he gets in two fights with a lightsaber, and he loses both - that's about what you'd expect, since he's just a former soldier with minimal training and good intentions, who happens to be holding a lightsaber.