Be careful to distinguish between the concepts of force and energy. Energy can get transformed between kinetic energy form, and various kinds of potential energy forms. So far we've seen gravitational and spring potential energy. When you compress or extend a spring from its equilibrium position, it stores potential energy. If you're squeezing the spring with your muscle, the energy comes from food you ate; if a block falls on a spring as in today's homework problem, the energy comes from the kinetic energy of the block and gravitational potential energy. (How this happens is a different question, without a very simple answer-- for the purpose of this course, think of the flow of energy as a model describing our world very well, in which conservation of energy is a fundamental rule.)
An important concept is that energy is always conserved in the universe, although it may be lost from a system via friction, heat, etc. (we'll be covering more about this later in the course).