Scott has answered your question. I'll give this all-too-frequent confusion another shot:
First, think Photoshop:
All Photoshop does is arrange a bunch of color values in rows and columns. Each "cell" in this array is a color value; nothing more.
A pixel is NOT a measure. It's just a color value. It has no intrinsic size. A pixel can be scaled to any measure you want it to be. That's what you are doing when you resize (not resample) an image in Photoshop; you are telling Photoshop to scale each pixel in the image to a new size, in the form of so-many-pixels-per-actual-unit-of-measure (most commonly, PPI; Pixels Per Inch).
Do you see that?
Pixels per Inch.
Pixels per Inch.
"Pixel" is just a color square. "Inch" is an actual measure. A pixel has no measure whatsoever until you scale it to an actual unit of measure. Without the "per whatever" the pixels in your image have no size.
When it all comes down, a Photoshop file contains one raster image. All the pixels in that image are scaled to the same measure. You can't grab a subset of the pixels and scale them to a different measure. Hold on...yes, I know Photoshop's interface lets you pretend to do that, but trust me, you can't. When you select a bunch of pixels and "scale" them, as soon as you commit the change, the actual pixels in the image are just recolored.
Because all the pixels in a Photoshop document are scaled the same, when the ruler is set to "Pixels," the ruler can be thought of as counting pixels.
Now, think Illustrator:
Illustrator individually arranges, scales, rotates, and distorts any number of entirely separate objects. Those individual objects can be text objects, path objects, or raster objects. Again, they can be individually scaled. So you can place a raster image in Illustrator and scale it so that its pixels measure 1/100th of an inch (100 PPI). You can place that same raster image again in the same Illustrator file and scale it so that its pixels measure 1/300th of an inch (300 PPI). Both instances of that image still have the same number of pixels. But they will not "measure" the same, even if you set Illustrator's rulers to "Pixels."
Because each raster image in an Illustrator file can be independently scaled to any size, when the ruler is set to "Pixels," the ruler cannot legitimately be thought of as counting pixels.
The rulers in Illustrator always represent real-world, physical measure for whatever eventual output method/environment the file is intended. Because "pixel" is not an actual measure, the use of "Pixels" as a supposed "unit of measure" is completely bogus. It's just an ill-conceived "convenience" for those who want the rulers to represent how many pixels the file will be rasterized to, if and when the whole thing is exported as a single raster image.
All too often--especially in Illustrator--supposed "convenience" features become time-wasting "confusion" features. The assumption of this particular "convenience" is that the user already understands all of the above. As is painfully evidenced by the frequency of recurrance of this very same topic in this forum, that assumption is as bogus as pretending that "pixel" is a unit of measure.
In other words, the people who are the target of this "intuitive convenience" (newcomers to vector programs dragging along some comfort-level in raster programs) are the very ones most likely to be confused by it, and the net result is anything but intuitive.
Since "pixel" is absolutely not a unit of measure, and since Illustrator's rulers always represent an actual measure, what is the actual measure being represented when one sets Illustrator's rulers to "Pixels"? The actual unit of measure is the typographer's point. A [modern] point measures 1/72 of an inch. When you set Illustrator's rulers to "Pixels," you are really setting them to Points.
I don't know which program actually started this particular interface idiocy, but Illustrator is far from the only vector drawing program that commits it. They should all be burned at the stake.
JET