The first law of thermodynamics doesn't actually specify that matter can neither be created nor destroyed, but instead that the total amount of energy in a closed system cannot be created nor destroyed (though it can be changed from one form to another
The first thing we have to do is determine what a "closed system" is. When we look at a physical situation and draw an imaginary circle around it, we're defining a system.
But once we've specified that the system is closed, it means that everything inside the system at that moment - the total amount of energy, be it potential energy (mass can be thought of as a kind of potential energy) or kinetic energy or both - must stay at that same, constant level. If the amount goes up or down, either the system isn't closed, or we've neglected to account for energy (for instance, heat) coming into the system or leaving the system. If we draw our imaginary circle around the universe, we can call the universe a closed system, but it means the total amount of energy in the universe has to remain the same - from its beginning until now.