Rendered File with After Effects is very Huge
Short Answer

It's all codec related, AE export follows the direction and settings you give him.

Your choice could be to export a super high bitrate lossless file or a few kb crappy thing horrible to see.

You say h264, probably you used an high bitrate, that could be good but better at this point go for an Intermediate use codec keeping h264 for the final distribution.



Long Answer

It's all depending the workflow you want to follow!  

My workflow generally consists in export the render with a true lossless (or if not possibile at least visually speaking lossless) very high bitrate codec in order to have a decent master.

Then i use that master to export the copies in the format i want with a tool like ffmpeg that is a super powerful command line tool that allows you to do all the transcoding and compression job.

Pros


You will not need to re-render again the AE Project saving tons of time.
You will not have troubles expecially as early user for not knowing too much about codec and settings. Compress in a lossy codec while rendering must have first of all a reason (like one only in my life render, target and never use the video again for something else) but also require knowledge obtained by lot of trial and errors that a pro have. If you start with a lossy codec in the rendering phase and you misconfig the settings you will end in a crappy file not good at all!


Cons


Video files will be bigger, but if you have at least a handy external drive all will be easier a nas could be better if you plan to grow and use this workflow for work.




Export your AE render with a Very High quality codec suited for post production or that could retain as much info as possible example a QuickTime movie contianer with Apple ProRes or Avid DNxHD 120 or 185 Mbit/s.

Store your file and use something like:

ffmpeg -i rendered.mov -c:v libx264 -crf 18 -c:a libfdk_aac -b:a 192k compressed.mp4


To obtain a smaller compressed version of your movie.

If you already exported with AE the audio in aac or a format you would like to keep use

ffmpeg -i rendered.mov -c:v libx264 -crf 18 -c:a copy compressed.mp4


Note: If you download the ffmpeg binaries for windows normally the libfdk_aac is not available, so you could use: libfaac or aac or libvo_aacenc