Energy credits are the primary currency in STO. You earn energy credits by completing missions and selling the items that you get via drops from mobs (both ground and space). The various vendors around space stations like Stardock and K7 will sell you moderately good gear in exchange for your energy credits.
The best way to sell items to earn energy credits is to go to a space station and sell them to a vendor instead of selling them to your replicator. If you sell them to your personal replicator (which you can access via your inventory when not at a space station) you end up taking about a 20% hit versus selling it directly to a space station vendor.
The other big thing you can use energy credits for is buying ships. Each ship costs 20,000 energy credits and can be purchased at any space station. However, it's important to remember that you automatically get one free ship each time you advance in rank (from lieutenant to lieutenant commander, for instance). Chance are you won't have to buy any ships until later in end-game when you want a different ship with different abilities.
Save your energy credits for that, and you'll be so rich you'll make even the Ferengi jealous.
Energy credits are tradeable with other players.
Starfleet merits are earned through completing missions. You don't get them for killing mobs, you can't trade them with other players. You have to earn them through your own hard work. Starfleet merits are harder to come by than energy credits. For instance, by the time I leveled up to a lieutenant commander, I had about 25,000 energy credits and about 1,800 Starfleet merits.
You can use Starfleet merits to buy bridge officers (which make your ship and away team crews more powerful) as well as train them with new ground and space combat skills. The primary way you'll spend your Starfleet merits is by purchasing these bridge officer upgrades. Expect to do this a lot, especially as you progress and your character develops into a more specialized role.
The other thing Starfleet merits are used for is to rename your ship and character, but that isn't something you're likely going to do more than once or twice -- if that.
We don't know a whole lot about these yet, but we do know that they'll be exchanged for some of the best gear available in the game (right now). The latest open beta patch began allowing us to collect them from completing exploration missions. There are four tiers of badges right now, presumably each different tier will equate to a different tier of ship/rank (ie: Captain, Admiral).
There's a lot of potential for these badges (especially higher level ones) to be used like WoW's badge system -- fill in the gear gaps that players may encounter in order to ease end-game gearing curves. If Cryptic is going to use them in this way, it'll be interesting to see how it plays out in the end-game once STO has been active for a bit.