It is very common to rub your eyes when getting out of bed! In fact most people do this. The explanation for why people do this is simple. First, when you are sleeping, often small amounts of tears leak out and collect at the edge of the eyelid. These form the "crust" that sometimes you may see when you wake up. This is a bit uncomfortable on awakening, and many people will reflexively rub their eyes to remove this crust. Secondly, the eyes do tend to dry out a bit when asleep. Rubbing the eyes stimulates the production of tears from the tear glands, which lubricates the eyes and gets them back to their normal daytime levels of tear production.
Occasionally, rubbing of the eyes can be done to relieve an itching sensation in the eyes on awakening. This is more common in people who have seasonal allergies or an allergy to something in the bedding (such as dust, mold, or mites). If you have symptoms of allergies (runny nose, itching eyes, sneezing, congestion), then you should talk to your primary care doctor
about this as there are excellent treatments for this.
As always, talk to your primary care doctor about this and any other basic health questions you may have.