Ant-Man is a Marvel Comics property. Marvel retained the rights to Ant-Man in cartoon and movie form. That is to say, they never licensed him out, even though there was interest in buying him (from Howard Stern of all people). Marvel Studios, Marvel Comic's movie arm, decided to include Ant-Man in the Marvel Cinematic Universe. That's why he's part of the MCU.
Spider-Man movie rights were licensed to Sony before Marvel ever thought of producing their own films. The X-Men were like wise licensed out to Fox. Including any Mutants, which causes problems for characters like Scarlet Witch and Quicksilver (The Twins in Age of Ultron). So Marvel Studios cannot legally use them in the MCU, without an agreement with Sony or Fox, depending on the character. Many more were licensed out, but most of those have reverted to Marvel. Thor for example, came back in 2006, from Sony, hence Marvel producing the Thor films. Right now, only X-Men (and any mutants, hence Deadpool), Spider-Man, and Fantastic Four are still licensed out.
None of the X-Men, Spider-Man, Fantastic Four, the previous Daredevil 2003 or Elektra 2005 films, Ghostrider, Blade Trilogy (A shame really) or even the upcoming Deadpool films (also a shame) are canon in the MCU. Only films produced by Marvel Studios for Marvel are canon. Notably, Daredevil, the 2015 Netflix TV series, is part of the MCU, as those rights were reverted.
Spider-Man of course, was recently lent by Sony to Marvel Studios, for inclusion in the MCU. Renting a guy their own lawnmower type deal, funny enough.