Put simply, the wpautop() filter changes double line-breaks in the text into HTML paragraphs (<p>…</p>).
This can, however, sometimes have annoying side affects. For example, it adds paragraph tags around image and script tags. This can have strange affects on page layouts, and may break scripts. We are strongly recommend to disable the wpautop() filter; and prevent it’s functionality from occurring.
To disable wpautop() install this plugin. After install, go to Settings > Auto Formatting and stop the automatic formatting for each area.
Remember, WordPress added this function for a reason. WordPress “assumes” the majority of the users are beginners. Therefore, they built this function to search the content; and adjust broken p tags. Disabling the filter also disables this ability to “fix” broken p tags.