Well its good that he started eating again.
As to why he didn't eat, who knows. When mine was smaller he'd stop eating all the time for any reason. If the water was too warm or cold, if the water wasn't flawless, if there wasn't enough current, if I added salt (he eventually got used to it, I add a little every water change), if the lights were on too long, if I farted in the next room, if the planets weren't aligned right or anything he'd stop eating. It was VERY frustrating.
Once I got him on pellets and onto a routine he started eating very well. I'll give him snacks whenever I think about it throughout the day and a really big meal every day at about 8pm. If I don't feed him he'll start spazzing and begging at the part of the tank where I put food. Stay they course man, you'll get him eating good in no time.