The short answer...
You have not properly trimmed the aircraft's control surfaces, in this case the elevator trim, for the speed you are trying to fly at... Or you are just trying to climb faster than that particular plane is capable of.
The slightly longer answer...
Essentially, you don't trim the elevator (pitch) of a plane to create a given rate of climb or descent. Nor do you trim for the sake of maintaining a particular altitude, (the absence of climb or descent). You trim for a specific airspeed... 90 knots for example.
When a plane is trimmed for 90 knots, physics does it's very best to always be doing that speed. When more power is added (increase throttle) the plane will pitch up and begin to climb, but it will still be doing it at 90 knots. Set the power back to what it was and the plane will level off. Decrease power and the plane will nose down and start descending in an attempt to regain that 90 knots (using gravity to supplement for the loss in thrust you might say).
For the most part that's it. try to climb faster than you have power for and you'll stall... which will then have you moving so slow that your nose will pitch down in an uncontrolled descent until you have gained enough airspeed from falling that it begins to pitch up again. However, since the descent was uncontrolled, the climb will be as well. and thus begins the condition you describe in your post. Of course it can just as easily start with a forced descent (pushing the stick forward in an attempt to descend without reducing power at the same time).
Lets look at descent for a moment. Setting aside the planning and decision making part of it, the first thing you do is reduce power. This makes the plane slow down, because the plane is moving slower than the trim is set for there is no longer enough air moving over the wings to maintain altitude and the plane starts to fall out of the sky. Since the tail of the plane has a big old whale tail that catches air the nose falls faster than the tail which creates a "nose down" condition. As the plane falls it picks up speed. As the speed increases the nose begins to pitch up. If left unchecked the speed will get too high (higher than the speed the plane is trimmed for) and the nose will keep rising until you are climbing again, at which point gravity plus climb with no added power will create a stall and it starts all over again with another uncontrolled descent.
Particularly in simulators it is very important to use the stick or control wheel to smooth out climb and descent transitions while the airspeed "catches up" to where it you have the plane trimmed. In the real world this effect exists too, but is generally much less severe and abrupt. For some reason flight simulator physics are way out of wack particularly when it comes to friction. I don't know why that is but it seems to be a constant in the flight sim world. Not enough friction on the ground, no wheel bearing friction at all most of the time, and not enough air friction either. I think it may have to do with making it easier to add VTOL (Vertical Take Off and Landing) planes to the sim but I've never caught a developer coming right out and saying what the reason is.
So remember, to climb... add power rather than just pulling back on the stick. To descend, reduce power rather than just pushing the stick forward. But in either case, use the stick to reduce the severity of the planes reaction until the airspeed evens back out especially if you are changing the flaps settings.
Wishing you clear skies and happy flying...