Firstly, you have to convert .avi to the format which is compatible with iPhone 4, such as .mp4 as well as .mov. A program is needed to assist you, you may choose iPhone Video Converter (http://www.imacsoft.com/iphone-video-converter.html), which is very smart and easy-to-use.
And if you are a mac user, you can choose the mac verion which has updated its version to support OS X Lion, get it by clicking http://www.imacsoft.com/iphone-video-converter-mac.html
Secondly, import converted files to iTunes library and then sync them to iPhone 4. After all done, you can share your favorite video files freely.
Hope it will be helpful to you.