The first step is to ensure your Gmail account is setup with IMAP enabled. The chances are good that IMAP is already enabled for you in Gmail, since it is the default. But, to set it, or double-check, just do the following:
In the upper right corner of your Gmail account, click the Settings link.
From the menu that it gives you, choose Forwarding and POP/IMAP.
This will bring up the screen shown below, from which you click on Enable IMAP.
Now you can open up your current Outlook account, presuming that this is the one you want to import into Gmail. If you want to import an archived account instead, you can use Outlook to open the appropriate *.pst file, such as archive.pst, or backup.pst, or whatever it is named. For me, all I had to do was open my current account, because all of stored emails are in it. [I have backup pst files (Outlook's file format), but I keep everything of interest to me in my current account.]
As a Precaution:
You may want to backup your Outlook data before doing the following steps. To do so, just use the File Menu, select Import/Export, and then select Export the data to a file (pst format). A set of dialog boxes will walk you through the process. Be sure to backup all the data by selecting the main folder and then check the box that for including subfolders.
Once you are within the appropriate Outlook file, create a new Outlook account. Set the Views within Outlook to show Folder View, and then it is simply a matter of copying your Outlook folders up under your Gmail account. You can grok this by examining a snapshot of my Outlook folders below:
Note that my original Outlook email account consists of all of the folders under “Personal Folders” and that my Outlook’s Gmail account is labeled “imap.gmail.com.” To copy items from the “Filed” folder in my Personal Folders to Gmail, I position the mouse on top of the Filed folder, hold down the Control key and drag the folder up under the “imap.gmail.com” folder. When I do so, Windows asks me if I want to Copy or Move the items. In my case, I selected Copy, so that my original Outlook email folders still contain the stored emails.
As soon as I do this, Outlook begins transporting the emails in my Filed folder into Gmail, assigning each of these emails a Label of Filed. For me, the whole process took under 20 minutes (for all folders of interest) … if you have thousands of stored emails, expect it to take longer.