You'd feel terrible laughing at the goofy love song your friend wrote and performed in front of an audience, especially if he sang it earnestly, or seriously and sincerely.
If you do something earnestly, you do it in a serious, heartfelt way. You might earnestly promise your friend that you'll never forget her birthday again, or earnestly ask your grandmother if there's anything you can do to help her out while she's recovering from surgery. If you earnestly study for your upcoming French exam, it means you're really buckling down to learn those vocabulary words. The Old English root of earnestly is eornost, which means "seriousness or serious intent."