Games in italics are not quite "main" games but not quite spin-offs either. For example, the Game Boy games (Dr. Wily's Revenge, II, III, IV, V, Xtreme, Xtreme 2) aren't "main" entries in the series, but they play like the main entries and have totally unique levels, as well as introducing some unique bosses and game mechanics. Because of this, some people consider them main games, and others don't. There's lots of different types of these non-main major entries, such as X: Command Mission (a JRPG), and Network Transmission (a sidescroller set in the usually-RPG Battle Network series).
Everyone has their own definition for what counts as a "main" game. I think it's safe to say that a list of "main" entries would include Mega Man 1-11, X1-8, Zero 1-4, ZX, and ZX Advent, but many would argue that this excludes several games that are definitely "main," such as Mega Man & Bass, which is considered by many fans (and even by
it's own code) as Mega Man 8.5. Sometimes "side" games are explicitly mentioned in "main" games, such as the Erasure Incident from Xtreme 2 being mentioned in X6. So while Xtreme 2 isn't necessarily a "main" game, it provides backstory that enhances the experience of the "main" games. I generally didn't include remakes on this list, even though they can be great content (i.e. Mega Man Powered Up), however I did include Rockman EXE Operate Shooting Star. It's a remake of Battle Network 1, but it has a whole extra bonus chapter connecting to the story of the Star Force series. I also included The Wily Wars, a remake of Mega Man 1-3, because it contains an additional short bonus game called Wily Tower.
The Mega Man franchise is divided into several series as follows: Classic, X, Legends, Battle Network (EXE in Japan), Zero, Star Force (Shooting Star in Japan), and ZX. The Classic, X, Zero, and ZX series are primarily sidescrolling platformers, with each series throwing in it's own spin on the formula. The Legends series is an action-RPG series (think 3D Zelda). The Battle Network and Star Force series are pseudo-turn-based card-battler RPGs. There's a direct storyline from the Classic -> X -> Zero -> ZX series, with Legends taking place in the far future. Battle Network and Star Force take place in a separate universe from the others.
All of this stuff is why I generally reccomend not playing in release order, because if you do, you'll be jumping around between different genres, storylines, and universes as you make your way through the franchise. For example, near the end of this list, you'll be rapidly switching between the PS2 X platformers, Zero/ZX metroidvanias, Battle Network RPGs, retro-revival classic platformers, and Star Force RPGs. If this constant change is ok with you or even if you think that makes it more interesting, by all means go for it - but it might get a little chaotic.